asr1 / AccessPlusPlus

A Chrome extension to improve AccessPlus for Iowa State University.
8 stars 3 forks source link

Some users report incorrect time zones when importing a calendar to a Google Calendar that is configured for a different time zone. #23

Open asr1 opened 9 years ago

asr1 commented 9 years ago

The present workaround is just to ensure that your Google Calendar is set to Central Time when you import the calendar.

ghmeier commented 9 years ago

There might be something else going on because my gCal and system time are pacific, yet the imported times were accurate relevant to central time.

asr1 commented 9 years ago

That's the tricky part. It isn't all users.

I've tried setting both the calendar and the events to Central, and I tried leveraging Moment.js, but ultimately that moved the time x hours in the wrong direction, where x is the discrepancy between your time and Central. It tried to compensate and it went poorly.

A particularly hacky solution I can think of is to get the user's time zone, find what central's time zone is based on the date (either CST or CDT, depending) , and subtract the two values to get some offset. You could then add this offset to every class time.

But, as I said, this is kind of hacky, and wouldn't work if you import the calendar in a different time zone than you downloaded it.

If it happened 100% of the time it would be a less pernicious issue.

asr1 commented 9 years ago

The probable way to fix this is by changing the ics.js file to 'DTSTART;VALUE=DATE-TIME;TZID=US-Central:' + start, 'DTEND;VALUE=DATE-TIME;TZID=US-Central:' + end, And then changing classSchedFunc.js so that it uses US-Central time instead of the Z (universal time) format. This may create an issue with daylight savings time(?), and is presently low priority.