DateToISO8601 returns wrong result if summertime and wintertime differ
Original Reporter info from Mantis: kluug.net @onpok
-
Reporter name: Ondrej Pokorny
Original Reporter info from Mantis: kluug.net @onpok
- Reporter name: Ondrej Pokorny
Description:
If summertime and wintertime differ (like it is in central Europe), DateToISO8601 returns a datetime with wrong timezone offset for the other time different from Now.
Steps to reproduce:
program Project1;
{$ifdef dcc}
{$APPTYPE CONSOLE}
{$endif}
uses SysUtils, DateUtils;
begin
Writeln(DateToISO8601(IncMonth(Now, 6), False));
Readln;
end.
Tested on 2019-06-12:
Delphi returns: 2019-12-12T16:01:43.00+01:00 (correct)
FPC returns: 2019-12-12T16:01:43.000+02:00 (wrong)
Additional information:
DateToISO8601 uses GetLocalTimeOffset that is not DateTime-aware. It must be made DateTime aware because the offset can vary during the year.