TryISO8601ToDate: support short time zone designators
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:
According to the ISO norm, the short time zone designators are also valid:
+0000
+00
https://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators
The attached patch adds support for them. (Currently only the +00:00 format is supported.)
Steps to reproduce:
Test project:
program ISODate;
uses
SysUtils, DateUtils;
var
D1, D2, D3: TDateTime;
begin
if TryISO8601ToDate('2019-01-01T10:00:00+04', True, D1)
and TryISO8601ToDate('2019-01-01T10:00:00+0400', True, D2)
and TryISO8601ToDate('2019-01-01T10:00:00+04:00', True, D3)
and SameDateTime(D1, D2) and SameDateTime(D2, D3)
then
Writeln(DateToISO8601(D1, True))
else
WriteLn('error');
end.
Mantis conversion info:
- Mantis ID: 35544
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 42040 (#43da0972).
- Target version: 3.2.0