Skip Menu |

This queue is for tickets about the DateTime-Format-ISO8601 CPAN distribution.

Report information
The Basics
Id: 104346
Status: resolved
Priority: 0/
Queue: DateTime-Format-ISO8601

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
SZABGAB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: parsing 1991-W01 throws exception
From the documentation it is unclear to me what "1991-W01" indicates but parsing "1991-W01" throws an exception while "1991-W02" parses.

Confirming: Tried all possible variations of week parsing I saw mentioned, can't get any of them to work in the proximity of week 1.

 

Week 54 ( which doesn't actually exist ) fails in a similar way, but Week 53 does not.

 

$ perl -d:Confess -MDateTime::Format::ISO8601 -e 'DateTime::Format::ISO8601->new->parse_datetime(q[2014-W01-1]) '
The 'day_of_year' parameter ("-1") to DateTime::from_day_of_year did not pass the 'is between 1 and 366' callback
 at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/x86_64-linux/DateTime.pm line 679.
    DateTime::from_day_of_year(undef, "year", 2014, "day_of_year", -1) called at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser/Regex.pm line 67
    DateTime::Format::Builder::Parser::Regex::make(DateTime::Format::Builder::Parser::Regex=HASH(0x29fc338), "2014-W01-1", undef, HASH(0x29fd578)) called at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser/generic.pm line 82
    DateTime::Format::Builder::Parser::generic::__ANON__[/home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser/generic.pm:84](DateTime::Format::ISO8601=HASH(0x27d7c00), "2014-W01-1", HASH(0x207d4f0)) called at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser.pm line 338
    DateTime::Format::Builder::Parser::__ANON__[/home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser.pm:342](DateTime::Format::ISO8601=HASH(0x27d7c00), "2014-W01-1", HASH(0x207d4f0)) called at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser.pm line 272
    DateTime::Format::Builder::Parser::__ANON__[/home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser.pm:285](DateTime::Format::ISO8601=HASH(0x27d7c00), "2014-W01-1") called at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser.pm line 63
    DateTime::Format::Builder::Parser::parse(DateTime::Format::Builder::Parser=HASH(0x29f1be8), DateTime::Format::ISO8601=HASH(0x27d7c00), "2014-W01-1") called at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder.pm line 139
    DateTime::Format::Builder::__ANON__[/home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder.pm:140](DateTime::Format::ISO8601=HASH(0x27d7c00), "2014-W01-1") called at -e line 1
 

 

 $ perl -d:Confess -MDateTime::Format::ISO8601 -e 'DateTime::Format::ISO8601->new->parse_datetime(q[2014-W53-1]) '


$ perl -d:Confess -MDateTime::Format::ISO8601 -e 'DateTime::Format::ISO8601->new->parse_datetime(q[2014-W54-1]) '
The 'day_of_year' parameter ("370") to DateTime::from_day_of_year did not pass the 'is between 1 and 366' callback
 at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/x86_64-linux/DateTime.pm line 679.
    DateTime::from_day_of_year(undef, "day_of_year", 370, "year", 2014) called at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser/Regex.pm line 67
    DateTime::Format::Builder::Parser::Regex::make(DateTime::Format::Builder::Parser::Regex=HASH(0x1afb468), "2014-W54-1", undef, HASH(0x1afc1f0)) called at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser/generic.pm line 82
    DateTime::Format::Builder::Parser::generic::__ANON__[/home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser/generic.pm:84](DateTime::Format::ISO8601=HASH(0x18d68c0), "2014-W54-1", HASH(0x117c4f0)) called at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser.pm line 338
    DateTime::Format::Builder::Parser::__ANON__[/home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser.pm:342](DateTime::Format::ISO8601=HASH(0x18d68c0), "2014-W54-1", HASH(0x117c4f0)) called at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser.pm line 272
    DateTime::Format::Builder::Parser::__ANON__[/home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser.pm:285](DateTime::Format::ISO8601=HASH(0x18d68c0), "2014-W54-1") called at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder/Parser.pm line 63
    DateTime::Format::Builder::Parser::parse(DateTime::Format::Builder::Parser=HASH(0x1af07e8), DateTime::Format::ISO8601=HASH(0x18d68c0), "2014-W54-1") called at /home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder.pm line 139
    DateTime::Format::Builder::__ANON__[/home/kent/perl5/perlbrew/perls/5.24.0-RC5/lib/site_perl/5.24.0/DateTime/Format/Builder.pm:140](DateTime::Format::ISO8601=HASH(0x18d68c0), "2014-W54-1") called at -e line 1
 

I'm guessing this is an off by one error in __normalize_week(). It would be great if someone could dig into this.