Google 某些日历没有 return 时区
Google doesn't return time zone for some calendars
我正在使用 Google Calendar API V3,在处理 Google 提供的时区时遇到一些困难。
在日历文档中:Calendars Overview
据说日历的时区是可选字段:
timeZone
string
The time zone of the calendar. (Formatted as an IANA Time Zone Database
name, e.g. "Europe/Zurich".) Optional.
However, it's also optional in CalendarList (https://developers.google.com/google-apps/calendar/v3/reference/calendarList).
如果在这两种情况下都未指定时区,Google 假设时区是什么?
假定时区是在日历本身中设置的时区。
要求:
GET https://www.googleapis.com/calendar/v3/calendars/primary
回应
{
"kind": "calendar#calendar",
"etag": "\"LOjlc76YTigzSZVQwSEE/E756z8zuickcYzaOnj8krCN4-Pk\"",
"id": "xxxx@gmail.com",
"summary": "xxx@gmail.com",
"timeZone": "Europe/Copenhagen"
}
创建新日历但未设置时区导致
{
"kind": "calendar#calendar",
"etag": "\"W8S50vTLOjlc76YTigzSZVQwSEE/cBQwQ2pDeiLoQ406eiNPZrDEINc\"",
"id": "ddd5qep4g260mm7fgq8vtgp18@group.calendar.google.com",
"summary": "testone",
"timeZone": "UTC"
}
我正在使用 Google Calendar API V3,在处理 Google 提供的时区时遇到一些困难。 在日历文档中:Calendars Overview
据说日历的时区是可选字段:
timeZone
string
The time zone of the calendar. (Formatted as an IANA Time Zone Database name, e.g. "Europe/Zurich".) Optional. However, it's also optional in CalendarList (https://developers.google.com/google-apps/calendar/v3/reference/calendarList).
如果在这两种情况下都未指定时区,Google 假设时区是什么?
假定时区是在日历本身中设置的时区。
要求:
GET https://www.googleapis.com/calendar/v3/calendars/primary
回应
{
"kind": "calendar#calendar",
"etag": "\"LOjlc76YTigzSZVQwSEE/E756z8zuickcYzaOnj8krCN4-Pk\"",
"id": "xxxx@gmail.com",
"summary": "xxx@gmail.com",
"timeZone": "Europe/Copenhagen"
}
创建新日历但未设置时区导致
{
"kind": "calendar#calendar",
"etag": "\"W8S50vTLOjlc76YTigzSZVQwSEE/cBQwQ2pDeiLoQ406eiNPZrDEINc\"",
"id": "ddd5qep4g260mm7fgq8vtgp18@group.calendar.google.com",
"summary": "testone",
"timeZone": "UTC"
}