-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
Wrong serializing&deserializing of TDateTime values, when local timezone <> 0. In the sample project datetime converts twice from UTC to local and we have wrong value of TDateTime field in the end.
"SuperRttiContextDefault.SuperDateTimeZoneHandling:= sdzLOCAL" has no effect.
program sobug2;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
superobject;
Var
s: String = '{"DocTime":"2024-05-24T21:52:11"}';
Type
TSomeTime = Class
DocTime: TDateTime;
End;
var
obj: TSomeTime;
ACTX: TSuperRttiContext;
begin
try
ACTX:= TSuperRttiContext.Create;
try
obj:= ACTX.AsType<TSomeTime>(SO(s));
WriteLn('old: ' + s);
s:= ACTX.AsJson<TSomeTime>(obj).AsJson(False, False);
WriteLn('new: ' + s);
finally
ACTX.Free;
end;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
pult and TimakovaViktoria
Metadata
Metadata
Assignees
Labels
No labels