Problem/Motivation
REST API endpoint "/bat_api/rest/calendar-events" returns date/datetime without timezone information.
[
{
"resourceId": 3,
"bat_id": 44,
"start": "2025-11-14T00:00:00",
"end": "2025-11-14T00:59:00",
"title": "N\/A",
"color": "#f04b4b",
"blocking": 1,
"fixed": 1,
"editable": false,
"type": "availability_hourly"
},
...
]
Since good practise is to operate on UTC it should return UTC timezone.
Steps to reproduce
Proposed resolution
Modify Event formatters files:
- /web/modules/contrib/bat/modules/bat_fullcalendar/src/FullCalendarFixedStateEventFormatter.php
- /web/modules/contrib/bat/modules/bat_fullcalendar/src/FullCalendarOpenStateEventFormatter.php
They should return date/datetime with timezone information, since default in the system is UTC, return should look like this:
[
{
"resourceId": 3,
"bat_id": 44,
"start": "2025-11-14T00:00:00Z",
"end": "2025-11-14T00:59:00Z",
"title": "N\/A",
"color": "#f04b4b",
"blocking": 1,
"fixed": 1,
"editable": false,
"type": "availability_hourly"
},
...
]
or
[
{
"resourceId": 3,
"bat_id": 44,
"start": "2025-11-14T00:00:00+00:00",
"end": "2025-11-14T00:59:00+00:00",
"title": "N\/A",
"color": "#f04b4b",
"blocking": 1,
"fixed": 1,
"editable": false,
"type": "availability_hourly"
},
...
]
Remaining tasks
User interface changes
API changes
Data model changes
Sponsorship
Comments
Comment #2
pozi commentedComment #3
afagioliComment #4
afagioliI have checked BAT code for time indicators. Timezone indicators are frequently omitted in date formatting. When present, UTC is rarely marked as "Z" (Zulu time), creating ambiguous timestamps. Options: use \Z for explicit UTC or P for timezone offsets. May be recommendable \Z for consistency with existing BAT usage. Standardise on clear timezone indicators.
Comment #6
afagioliComment #7
pozi commentedI was having an issue in fullcalendar when i change it's mode to timeZone={'local'}. Since this is API and it's response might be a part of a 3rd party system i think here we need to provide timezone context. Now browser detection timzeone can be properly recalculated according to dynamic timezone from UTC. Your changes looks OK to me. Thank you for quick reaction!
Comment #8
afagioli