[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-datetime
Subject:    Re: [rt.cpan.org #47691] 29 feb 2009 -> to_datetime fails...
From:       "Flavio S. Glock" <fglock () gmail ! com>
Date:       2009-07-08 22:15:05
Message-ID: aa47605d0907081515s5718291dob33f0d26fbb11967 () mail ! gmail ! com
[Download RAW message or body]

DateTime::Incomplete

0.04  2009-07-08
- to_datetime() failed when the current year is a non-leap year and
  the incomplete date is a leap day,
  bug reported by Alexandre Masselot.

Flávio S. Glock

2009/7/8 Alexandre Masselot via RT <bug-DateTime-Incomplete@rt.cpan.org>:
> Wed Jul 08 05:43:35 2009: Request 47691 was acted upon.
> Transaction: Ticket created by ALEXMASS
>       Queue: DateTime-Incomplete
>     Subject: 29 feb 2009 -> to_datetime fails...
>   Broken in: (no value)
>    Severity: Important
>       Owner: Nobody
>  Requestors: alexandre.masselot@genebio.com
>      Status: new
>  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=47691 >
>
>
> Hi Flavio
>
> I'm using your module with pleasure, but I have a little concern.
>
> we are in 2009. If I make the test
> my $dti = DateTime::Incomplete->new( month => 2, day => 29, year=>2000);
> ok($dti->to_datetime(), "29 feb 2000");
>
> I get...
> Invalid day of month (day = 29 - month = 2 - year = 2009)
>  at /Library/Perl/5.8.8/DateTime/Incomplete.pm line 639
>
> looking around line 639
>    for $key ( <b>reverse @FIELDS_SORTED</b> )
>    {
>        $value = $self->{has}{$key};
>        next unless defined $value;
>        if ( $key eq 'time_zone' )
>        {
>            $result->set_time_zone( $value );
>            next;
>        }
>        $result->set( $key => $value );
>    }
>
> and the year is set at the end of the process, thus is 2009 when 29th of
> feb is set => error!!!!
>
> I you wrote the code in 2008, you had not hit that problem...
>
> cheers
> Alex
>
>
>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic