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: 93347
Status: resolved
Priority: 0/
Queue: DateTime

People
Owner: Nobody in particular
Requestors: vytdau [...] gmail.com
Cc:
AdminCc:

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



Subject: truncate modifies original date when failing
Date: Tue, 25 Feb 2014 15:27:44 +0000
To: bug-DateTime [...] rt.cpan.org
From: Vytautas D <vytdau [...] gmail.com>
DateTime should not modify original object if it fails, consider this: use DateTime; use Test::More tests => 2; my $dt = DateTime->new( year => 2010, month => 3, day => 25, hour => 1, minute => 5, time_zone => 'Asia/Tehran', ); is( $dt->day_of_week(), '4', 'We start on Thursday' ); eval { $dt->truncate(to => 'week'); } || warn "Eval failed with '$@'\n"; is( $dt->day_of_week(), '4', 'should retain 4' ); Output is: 1..2 ok 1 - We start on Thursday Eval failed with 'Invalid local time for date in time zone: Asia/Tehran ' not ok 2 - Should retain 4 # Failed test 'Should retain 4' # got: '1' # expected: '4' # Looks like you failed 1 test of 2.