Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime CPAN distribution.

Report information
The Basics
Id: 97046
Status: resolved
Priority: 0/
Queue: DateTime

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

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



Subject: adding extremely large number of days fails (related to leap years)
Here is a failing code:
use DateTime;

my $DAY_ONE = DateTime->new(year => 0, month => 1, day => 1);

warn $DAY_ONE->clone->add(days => 268526343)->ymd, "\n";        # 735200-02-27
warn $DAY_ONE->clone->add(days => 268526344)->ymd, "\n";        # 735200-02-28
warn eval { $DAY_ONE->clone->add(days => 268526345)->ymd };     # FAILS (should be 735200-02-29)
warn $DAY_ONE->clone->add(days => 268526346)->ymd, "\n";        # 735200-03-01
warn $DAY_ONE->clone->add(days => 268526347)->ymd, "\n";        # 735200-03-02

the failure is: Invalid day of month (day = 30 - month = 2 - year = 735200)

I am using: perl 5.18.2 (MSWin32 / x86) + DateTime 1.10

--
kmx
There's a fix for this in the 1.15 trial release. If I see no new breakage on CPAN tester I'll do a proper release with this fix in the future. That sounds, there is still some number that will be too large, it's just now system-dependent.