This is just as much for future reference to our selves as an explanation of current state of time zone handling in MDriven Turnkey.
UTC - Coordinated Universal Time
The world is divided into time zones – GMT + or – Some hours.
The “Some hours” change depending on time of year due to daylight saving strategies applied by users of different time zones.
This means that if you enter 2015-01-01 in a browser that resides in Sweden - plus 1 hour (in January anyway) – and then send back the value to the server for storage in UTC – you will store 2014-12-31 23:00. This is what most developers would say was less than perfect…
And currently our take on this is that it is wrong in most of all cases.
Ok – I do not say that time zones are unnecessary and should be ignored – I just say that in 99% percent of all systems that I have been involved in dates and times should be handled just as the user entered them. Times and Dates should move around in the system – from front end to backend and to and from database without being inspected from different angles or time zones.
When time zones are important – there will almost always be some other data in the model that explains what and why that time zone should be used.
#1 Connecting flights always show up in the local airport time (where the connection is). The fact that it is the airport that has a time zone and not the browser in this case must be clear. Hence should the location of the airport be what controls the time zone – not the location of the browser entering or reading the information.
When I have been trying to get my head around these issues I have found tons of stackoverflow posts that state that we can just use d.getTimezoneOffset() and compensate for time zone stuff – no problemo! Well – if I enter a summer date in winter time it will be 1 hour off if I am in a time zone that use daylight saving… Show stopper!
This solution makes most sense to me right now and things stop to be strange – like having odd values in the database just because the time was entered in a browser that happened to be in a +X time zone.