You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just realized I filed this ticket on the wrong branch. Re-filed to kidd/org-gcal.el. Not sure how to delete an issue.
I am very excited to try out org-gcal, and was puzzled that the timestamps for my calendar events are sometimes right, sometimes wrong. With some digging, I found the issue is this:
For unknown reason, Google calendar API does not returns timestamps in consistent timezones. At least that is the case for my family shared calendar (a build in feature by Google). Family calendar timezone is fixed to UTC, although when an event is created, that event is created with default local time zone (US eastern time for me). I verified my events are created correctly in US eastern time. But when org-cal fetch them, for some events, the time is returned in eastern time, but for some other events the time is returned in UTC time (the time itself is always correct, just represented in different time zones)
It becomes a problem for the following function
(defun org-gcal--convert-time-to-local-timezone (date-time local-timezone)
(if (and date-time
local-timezone)
(format-time-string "%Y-%m-%dT%H:%M:%S%z" (parse-iso8601-time-string date-time) local-timezone)
date-time))
When org-gcal-local-timezone is set to nil, date-time is directly returned, hence sometimes it is wrong (for those in UTC time).
But, if we set org-gcal-local-timezone to my local time zone, it also poses some issues:
I found the time zone string is very finicky for format-time-string. For example "America/New York" does not work properly on either Windows or Linux. (current-time-zone) returned from Emacs does not work on Windows but works for Linux. (-14400 "EDT") works on both. Such a pain.
When local time zone is set to nil, we have the nice behavior that the time will be automatically set to the time zone for that particular date. Time zone is not only determined by location, but also date, because of day light savings time.
For example (note the different time zone in the result):
(format-time-string "%Y-%m-%dT%H:%M:%S%z" (parse-iso8601-time-string "2021-09-29T12:15:00-04:00") nil) => "2021-09-29T12:15:00-0400"
(format-time-string "%Y-%m-%dT%H:%M:%S%z" (parse-iso8601-time-string "2021-12-29T12:15:00-04:00") nil) => "2021-12-29T11:15:00-0500"
So it seems to me the best option is to change the function org-gcal--convert-time-to-local-timezone to:
(defun org-gcal--convert-time-to-local-timezone (date-time local-timezone)
(format-time-string "%Y-%m-%dT%H:%M:%S%z" (parse-iso8601-time-string date-time) local-timezone))
This will make the out-of-box default behavior work for 99% of us.
The above was tested on both Windows and Linux, Emacs 26.3.
Thanks for this great package.
The text was updated successfully, but these errors were encountered:
Just realized I filed this ticket on the wrong branch. Re-filed to kidd/org-gcal.el. Not sure how to delete an issue.
I am very excited to try out org-gcal, and was puzzled that the timestamps for my calendar events are sometimes right, sometimes wrong. With some digging, I found the issue is this:
For unknown reason, Google calendar API does not returns timestamps in consistent timezones. At least that is the case for my family shared calendar (a build in feature by Google). Family calendar timezone is fixed to UTC, although when an event is created, that event is created with default local time zone (US eastern time for me). I verified my events are created correctly in US eastern time. But when org-cal fetch them, for some events, the time is returned in eastern time, but for some other events the time is returned in UTC time (the time itself is always correct, just represented in different time zones)
It becomes a problem for the following function
(defun org-gcal--convert-time-to-local-timezone (date-time local-timezone)
(if (and date-time
local-timezone)
(format-time-string "%Y-%m-%dT%H:%M:%S%z" (parse-iso8601-time-string date-time) local-timezone)
date-time))
When org-gcal-local-timezone is set to nil, date-time is directly returned, hence sometimes it is wrong (for those in UTC time).
For example (note the different time zone in the result):
(format-time-string "%Y-%m-%dT%H:%M:%S%z" (parse-iso8601-time-string "2021-09-29T12:15:00-04:00") nil) => "2021-09-29T12:15:00-0400"
(format-time-string "%Y-%m-%dT%H:%M:%S%z" (parse-iso8601-time-string "2021-12-29T12:15:00-04:00") nil) => "2021-12-29T11:15:00-0500"
(defun org-gcal--convert-time-to-local-timezone (date-time local-timezone)
(format-time-string "%Y-%m-%dT%H:%M:%S%z" (parse-iso8601-time-string date-time) local-timezone))
This will make the out-of-box default behavior work for 99% of us.
The above was tested on both Windows and Linux, Emacs 26.3.
Thanks for this great package.
The text was updated successfully, but these errors were encountered: