Thanks!
]]>Could you send some pull requests?
Thanks!
My API is used by different clients written using different programming languages, and in some languages de-serialization of the ISO date is "pattern based", for example in Oracle such terrible construction is used:
to_timestamp_tz ('2014-09-12T11:53:06Z', 'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM')
and it fails if ISO string is come without seconds in form '2014-09-12T00:00Z'
Something similar is in the Objective-C.
So, my proposal is to add a seconds for dates (change 'T00:00Z' -> 'T00:00:00Z' into mORMot.pas), in this case the same pattern can be used to decode time with and without seconds. I think it should not broke an existed code.
]]>I'll investigate how use mORMot UTC with string datetime received from external gateway in the format aforementioned.
Thanks again.
Esteban
]]>Or use it as UTC value by convention on the client side.
]]>But there is another problem - in case client convert DateTime to UTC server also must obviously sad to client dates is in UTC format. As I point in this topic current implementation do not do this.
So in my fork of mORMot I made several modification to add 'Z' (and 'T00:00Z' in case of Date w/o time) to the end of time string ( TSQLTableJSON serialization, TJSONSerializer.WriteObject ) during serialization result to client.
It is to the ui layer to convert to/from local time.
]]>class function IMRUtils.ISO8601ToDateTime(const aValue: String): TDateTime;
var
lTimeZone: TTimeZoneInformation;
begin
Result := SynCommons.Iso8601ToDateTime(aValue);
if (aValue <> '') and (aValue[Length(aValue)] in ['Z', 'z']) then
begin
GetTimeZoneInformation(lTimeZone);
Result := IncHour(Result, (lTimeZone.Bias div -60));
end;
end;
This works fine, but I want to know if the framework support timezone. if so, I could not find.
TIA.
Esteban.
]]>