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

pozi created an issue. See original summary.

pozi’s picture

Issue summary: View changes
afagioli’s picture

Status: Active » Needs work
afagioli’s picture

I 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.

  • afagioli committed 0a865180 on 11.1.x
    feat: Add Z UTC timezone indicator to date formatting
    
    - Append 'Z' (...
afagioli’s picture

Status: Needs work » Needs review
pozi’s picture

I 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!

afagioli’s picture

Status: Needs review » Reviewed & tested by the community