blob: c4836a96b8d8f0e4a3b3d67d26e2834c7692f72a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
use Test::More tests => 13;
BEGIN { use_ok('Time::Piece'); }
ok(1);
my $t = gmtime(951827696); # 2000-02-29T12:34:56
is($t->mon, 2);
is($t->mday, 29);
my $t2 = $t->add_months(1);
is($t2->year, 2000);
is($t2->mon, 3);
is($t2->mday, 29);
my $t3 = $t->add_months(-1);
is($t3->year, 2000);
is($t3->mon, 1);
is($t3->mday, 29);
# this one wraps around to March because of the leap year
my $t4 = $t->add_years(1);
is($t4->year, 2001);
is($t4->mon, 3);
is($t4->mday, 1);
|