houseabsolute / DateTime-Format-ISO8601

Parses ISO8601 formats
http://metacpan.org/release/DateTime-Format-ISO8601/
Other
3 stars 3 forks source link

"-00:00" isn't standard-conforming #5

Open autarch opened 3 years ago

autarch commented 3 years ago

Migrated from rt.cpan.org #77535 (status was 'open')

Requestors:

Attachments:

From zefram@fysh.org on 2012-05-30 15:45:47 :

DateTime::Format::ISO8601, when parsing, allows a zero timezone offset to be given with either sign:

$ perl -MDateTime::Format::ISO8601 -lwe 'print +DateTime::Format::ISO8601->parse_datetime("2000-01-01T12:00:00+00:00")' 2000-01-01T12:00:00 $ perl -MDateTime::Format::ISO8601 -lwe 'print +DateTime::Format::ISO8601->parse_datetime("2000-01-01T12:00:00-00:00")' 2000-01-01T12:00:00

ISO 8601 actually only allows "+" here, not "-". See the explanation for the plus-or-minus sign in ISO 8601:2000 clause 5.1.1 or ISO 8601:2004 clause 3.4.2. The parsing function should reject "-" just as it rejects "!".

-zefram

autarch commented 3 years ago

From jhoblitt@cpan.org on 2012-06-04 05:57:25 :

I agree that this is a bug. Do you have a patch or want to try a hand at adding tests for the problem?

-Josh

--

autarch commented 3 years ago

From bitcard@chimpychompy.org on 2012-07-17 22:08:33 :

On Mon Jun 04 01:57:25 2012, JHOBLITT wrote:

I agree that this is a bug. Do you have a patch or want to try a hand at adding tests for the problem?

Tests and a possible fix attached. Not sure if this is the best way to address the issue, but it seemed easier than trying to reject a -ve tz offset in the regex.