Warm tip: This article is reproduced from serverfault.com, please click

Google Calendar API events list time zone issue

发布于 2020-12-01 09:24:51

Since mid of last week I witnessed increasing issues with the events list query params for upper and lower bounds. Since the weekend it is no longer working at all.

Issue summary: Positive timezone offsets no longer accepted in events list query params for time bounds.

Api call:

GET https://www.googleapis.com/calendar/v3/calendars/<myCalendarId>/events

with query params: ?timeMin=2020-12-01T09:31:04+0100

Expected behavior and behavior until around Nov 25th, on some servers until Nov 27th:

{
    "kind": "calendar#events",
    "etag": "\"blahblah\"",
    "summary": "blahblah",
    "updated": "2020-12-01T07:46:56.357Z",
    "timeZone": "Europe/Berlin",
    "accessRole": "owner",
    "defaultReminders": [
        {
            "method": "popup",
            "minutes": 30
        }
    ],
    "nextSyncToken": "blahblah",
    "items": [
    ...

Actual behavior / response body:

{
    "error": {
        "errors": [
            {
                "domain": "global",
                "reason": "badRequest",
                "message": "Bad Request"
            }
        ],
        "code": 400,
        "message": "Bad Request"
    }
}

Further details: Apparently the "bad request" response is solely induced by the plus (+) symbol before the time zone offset. Changing the "+" to a "-" in the above request will return a valid response as expected only that the offset is wrong (in this case by two hours as it should be). Writing the offset with or without ":" (e.g. +01:00 vs +0100) does not affect results.

Most likely I have missed something like a depreciation of positive time zone offsets or I was anyway using a wrong time format since I am admittedly not an expert in the RFC3339.

The other option is that the Google calendar team has updated their parser in their calendar API and in the wake of that deployed a bug. In that case a test case should be added to the pipeline for testing several time zone offsets including the limits.

I would be happy to receive advice on how to gracefully select and time zone east of UTC. Thanks a lot in advance!

Questioner
BB-5000
Viewed
11
ziganotschka 2020-12-01 18:45:07

There is no such deprecation, but when you make an HTTP request you need to URL encode the parameters

Sample:

https://www.googleapis.com/calendar/v3/calendars/primary/events?q=timeMin%3D2020-12-01T09%3A31%3A04%2B0100

enter image description here