Skip Menu |

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

Report information
The Basics
Id: 24335
Status: rejected
Priority: 0/
Queue: DateTime-Format-ISO8601

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

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



Subject: Tests fail at 02_examples.t, test 49
I attempted to install DateTime::Format::ISO8601 0.0403 from CPAN on my Mac (OS 10.4.8, Perl 5.8.8 for darwin-2level from darwinports). To wit: not ok 49 # Failed test at /Users/kevinr/.cpan/build/DateTime-Format-ISO8601-0.0403/t/02_examples.t line 275. # got: '14' # expected: '15' (This is, thankfully, the only test failure.) Any idea what's going on? - Kevin -- Kevin Riggle <kevinr@bestpractical.com> Best Practical Solutions, LLC
From: ARC [...] cpan.org
On Thu Jan 11 21:18:53 2007, KEVINR wrote: Show quoted text
> DateTime::Format::ISO8601 0.0403 > # Failed test at > /Users/kevinr/.cpan/build/DateTime-Format-ISO8601-0.0403/t/02_examples.t > line 275. > # got: '14' > # expected: '15'
The same thing happens to me. It seems to be a bug exposed by the fact that January 1st 2007 fell on a Monday. The attached patch fixes this bug, and adds more test cases in this area. -- Aaron Crane
diff -urN DateTime-Format-ISO8601-0.0403.orig/lib/DateTime/Format/ISO8601.pm DateTime-Format-ISO8601-0.0403/lib/DateTime/Format/ISO8601.pm --- DateTime-Format-ISO8601-0.0403.orig/lib/DateTime/Format/ISO8601.pm 2005-08-08 00:22:14.000000000 +0100 +++ DateTime-Format-ISO8601-0.0403/lib/DateTime/Format/ISO8601.pm 2007-01-21 11:53:59.000000000 +0000 @@ -963,6 +963,9 @@ if( defined $p{ parsed }{ day_of_year } ) { $p{ parsed }{ week } -= $dt->day_of_week -1; } + elsif( $dt->day_of_week == 1 ) { + $p{ parsed }{ week } += 1; + } $p{ parsed }{ day_of_year } += $p{ parsed }{ week }; diff -urN DateTime-Format-ISO8601-0.0403.orig/t/02_examples.t DateTime-Format-ISO8601-0.0403/t/02_examples.t --- DateTime-Format-ISO8601-0.0403.orig/t/02_examples.t 2005-08-08 00:22:14.000000000 +0100 +++ DateTime-Format-ISO8601-0.0403/t/02_examples.t 2007-01-20 20:28:26.000000000 +0000 @@ -9,7 +9,7 @@ use lib qw( ./lib ); -use Test::More tests => 175; +use Test::More tests => 182; use DateTime::Format::ISO8601; @@ -275,6 +275,15 @@ is( $dt->week_number, '15' ); } +# Each of these seven years has January 1st fall on a different day of the week +for my $year (2007 .. 2012, 2014) { + my $base = DateTime->new( year => $year ); + my $parser = DateTime::Format::ISO8601->new( base_datetime => $base ); + my $dt = $parser->parse_datetime( '-W15' ); + is( $dt->week_number, '15', + "parse correct week number from '-W15' in $year" ); +} + { #-W-D -W-5 my $dt = DateTime::Format::ISO8601->parse_datetime( '-W-5' );
Thanks and kudos to ARC for providing the patch. Unfortunately it cannot be applied because it is somehow whitespace stripped. I applied it manually and uploaded it to my CPAN directory as ANDK/patches/DateTime-Format-ISO8601-0.0403-ARC-01.patch.gz so that it can be downloaded an applied with the patch program. I hope this is OK for you.
Subject: Re: [rt.cpan.org #24335] Tests fail at 02_examples.t, test 49
Date: Thu, 1 Feb 2007 15:52:44 -0500
To: Andreas Koenig via RT <bug-DateTime-Format-ISO8601 [...] rt.cpan.org>
From: kevinr [...] bestpractical.com (Kevin Riggle)
On Sat, Jan 27, 2007 at 11:03:40AM -0500, Andreas Koenig via RT wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=24335 > > > Thanks and kudos to ARC for providing the patch. Unfortunately it cannot > be applied because it is somehow whitespace stripped. I applied it > manually and uploaded it to my CPAN directory as > ANDK/patches/DateTime-Format-ISO8601-0.0403-ARC-01.patch.gz > so that it can be downloaded an applied with the patch program. I hope > this is OK for you.
Awesome -- it seems to work now. Thank you, and thanks to ARC for the patch. - Kevin -- Kevin Riggle <kevinr@bestpractical.com> Best Practical Solutions, LLC
I believe this is stale now...