#1 2013-06-02 13:47:36

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,544
Website

ISO8601 timezone and mORMot

By now mORMot use ISO8601 date/time format without timezone information ( '2013-06-02T16:10:00' ). ISO8601 says, we must look on such string as on LOCAL time. So if I'm in GMT+3 timezone '2013-06-02T16:10:00' =  '2013-06-02T13:10:00Z'. But then I use mORMot server and browser client different browser use different algoritm to parse ISO date/time. Examples:

// FireFox think this is a local time - as defined in ISO8601
-> var d = new Date('2013-06-02T14:14:14'); JSON.stringify(d);
<- "\"2013-06-02T11:14:14.000Z\""
//but IE 9 and Chrome think this is UTC0 time
<- ""2013-06-02T14:14:14.000Z"" 

So my suggestion is to add "Z" in  *TimeToIso8601* serialization/deserialization functions, so I always know time is in UTC format.
All browser work correctly with ISO8601 with timezone format '2013-06-02T14:14:14Z'.

And it gives us the opportunity to not only work correctly with browsers-type client, but to handle clients from different time zones.
Regression (previous mORMot version/mORMot user who do not need timezone information) may ignore timezone information and think about dates as about local dates as it is now. User who need timezones may store information in DB in UTC timezone, perform client-level conversion to local time (as browser does)  and handle clients from different timezone (as this forum software does, for example).
What do you think?

Last edited by mpv (2013-06-02 13:51:17)

Offline

#2 2013-06-03 08:52:50

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,238
Website

Re: ISO8601 timezone and mORMot

Worth a ticket, and a dedicated parameter.

Could be a breaking change for existing applications, which expect the time to be local.
Perhaps a dedicated method to allow in-place modification of the time in the DB.

So it will also impact SQLite3i18n and mORMot.pas.

Offline

Board footer

Powered by FluxBB