amaster507 / ifbmt

Independent Fundamental Baptist Missionary Trails
GNU General Public License v3.0
5 stars 0 forks source link

Calendar and timezones #18

Closed amaster507 closed 6 years ago

amaster507 commented 7 years ago

The issue of timezones was brought up by @andrewwippler when tagging the calendar Orion of the app.

Here is my thoughts for this process:

Let me know if your thoughts and suggestions for this.process.

andrewwippler commented 7 years ago

store all bookings, notes and events in UTC and then display according to the setting chosen at the time.

conflicts with

when booking the meeting the time will be saved as UTC offset by the churches local time.

You will want most of the timezone calculations on the save aspect and not on the retrieve. If you sanitize all timezone data (i.e converting it to Z+00:00 before save) it makes it that much easier on the presentation layer - you can assume the data you are retrieving is already UTC.

amaster507 commented 7 years ago

@andrewwippler so I did not make my thoughts very clear there obviously, I apologize. When booking the meeting and the meeting is at say 6:00 PM and the user is in CDT (UTC-5) and the church is in EDT (UTC-4) then the meeting would be saved as 6:00 - 4 to save the EDT as UTC. And when adding a note the timestamp would be saved as the current UTC time.

Basically yes to what you said:

You will want most of the timezone calculations on the save aspect and not on the retrieve. If you sanitize all timezone data (i.e converting it to Z+00:00 before save) it makes it that much easier on the presentation layer - you can assume the data you are retrieving is already UTC.

amaster507 commented 7 years ago

This comment will be more for my technical reference:

All of the churches are saved in the database and have a latitude and longitude. What is needed is to also store additional timezone information such as:

Field Description
zoneName The time zone name.
abbreviation Abbreviation of the time zone.
gmtOffset The time offset in seconds based on UTC time.
dst Whether Daylight Saving Time (DST) is used. Either 0 (No) or 1 (Yes).
dstStart The Unix time in UTC when current time zone start.
dstEnd The Unix time in UTC when current time zone end.

This information can be obtained from:

I believe that TimeZoneDB appears easier to use and implement. The only drawback is that requests are throttled to 1ps, but this should not be an issue because this would only need to pull the information once per location and then save it in the database when needed next time.

amaster507 commented 6 years ago

added to roadmap https://trello.com/c/YwRODhPw/27-timezones