REST API and user timezones

It seems the REST API is not accounting for the user timezone: we tried several ‘set_entry’ calls to create a meeting with different users having different timezone settings but the start and end dates are always stored in the DB with no conversion (meeting set to start at 10 in the morning is saved as starting at 10 in the morning server time…)

It is my understanding and observation that every date in the database is stored as UTC/GMT, which makes sense as a basis for displaying for each user. It is also clear that the user timezone is taken into account when creating the meetings from within the CRM (meeting starting at 10 in the morning user time will be converted to UTC prior to being saved in the DB).

So my question: are the REST calls timezone agnostic? Is there a setting to make them aware of the user timezone settings? Should the timezone management be handled by the client application??

Thanks

I’ve had this kind of behavior, what I did was to declare the timezone in my custom php that is calling for the rest api

best regards

Indeed, there is an issue on the API for dates.
The date format takes the user timezone whereas the date sent is database format (UTC/GMT).

Just modify Api\V8\JsonApi\Helper\AttributeObjectHelper.php the getAttributes function to force the UTC timezone:

public function getAttributes(\SugarBean $bean, $fields = null)
    {
        $bean->fixUpFormatting();

        // 20240417 VAU -> Force timezone to DB
        date_default_timezone_set('UTC');
        // 20240417 VAU <-

        // using the ISO 8601 format for dates
        $attributes = array_map(function ($value) {
            return is_string($value)
                ? (\DateTime::createFromFormat('Y-m-d H:i:s', $value)
                    ? date(\DateTime::ATOM, strtotime($value))

Can you make a PR on github for your fix?