Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: me+pause [...] pedrofigueiredo.org
Cc:
AdminCc:

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



Subject: Bug in _fix_1_digit_year
 Hi,

Due to the way _fix_1_digit_year is written, it sets the year incorrectly after 2010. I spotted this today when I noticed the tests failing (lines 231, 239, 247, and 254 in 02_examples.t).

As a suggestion, imo it would be better to add the parsed year instead of using the regular expression and string concatenation.

Cheers,

Pedro
From: olaf [...] wundersolutions.com
On Mon Jan 04 11:48:10 2010, pfig wrote: Show quoted text
> Hi, > > Due to the way _fix_1_digit_year is written, it sets the year > incorrectly after > 2010. I spotted this today when I noticed the tests failing (lines > 231, 239, > 247, and 254 in 02_examples.t). > > As a suggestion, imo it would be better to add the parsed year
instead Show quoted text
> of using > the regular expression and string concatenation. > > Cheers, > > Pedro
After reading this ticket, I had a closer look at Pedro's suggestion. The following would fix the bug: sub _fix_1_digit_year { my %p = @_; no strict 'refs'; my $year = ( $p{ self }{ base_datetime } || DateTime->now )- Show quoted text
>strftime('%C') * 100;
use strict; $p{ parsed }{ year } = $year + $p{ parsed }{ year }; return 1; } I've forked the repo from GitPan and there's a patched version available here: http://github.com/oalders/DateTime-Format-ISO8601 Olaf
Is this issue still present in the 0.08 release? If so, I would appreciate a few test cases. Thanks, -Josh