Subject: | add_months method loses localtime |
The 'add_months' method is losing the localtime setting. Consider:
#!/usr/bin/perl
use warnings; use strict;
use Time::Piece;
use constant 'c_islocal' => 10;
print '$Time::Piece::VERSION='.$Time::Piece::VERSION."\n";
my $t1 = localtime;
print 'length='.scalar @$t1.', $t1[c_islocal]='.$t1-
Show quoted text
>[c_islocal]."\n";
my $t2 = $t1->add_months(1);
print 'length='.scalar @$t2.', $t2[c_islocal]='.$t2-
Show quoted text>[c_islocal]."\n";
This is producing:
$Time::Piece::VERSION=1.15
length=11, $t1[c_islocal]=1
length=12, $t2[c_islocal]=0
I would have expected:
$Time::Piece::VERSION=1.15
length=11, $t1[c_islocal]=1
length=11, $t2[c_islocal]=1