@@ -29,7 +29,7 @@ my $dt = DateTime.new(
29
29
);
30
30
31
31
say $dt; # 2015-11-21T16:01:00Z
32
- say $dt.later(day => 20); # 2015-12-11T16:01:00Z
32
+ say $dt.later(days => 20); # 2015-12-11T16:01:00Z
33
33
say $dt.truncated-to('hour'); # 2015-11-21T16:00:00Z
34
34
say $dt.in-timezone(-8 * 3600); # 2015-11-21T08:01:00-0800
35
35
@@ -293,22 +293,23 @@ Returns a DateTime object based on the current one, but with a time delta
293
293
applied. The time delta can be passed as a named argument where the argument
294
294
name is the unit.
295
295
296
- Allowed units are C < second > , C < minute > , C < hour > , C < day > , C < week > , C < month > ,
297
- C < year > .
296
+ Allowed units are C < second > , C < seconds > , C < minute > , C < minutes > , C < hour > ,
297
+ C < hours > , C < day > , C < days > , C < week > , C < weeks > , C < month > , C < months > , C < year > ,
298
+ C < years > .
298
299
299
300
Please note that the special ":2nd" named parameter syntax can be a compact
300
301
and self-documenting way of specifying the delta
301
302
302
- say DateTime.new('2015-12-24T12:23:00Z').later(:2year );
303
+ say DateTime.new('2015-12-24T12:23:00Z').later(:2years );
303
304
# 2017-12-24T12:23:00Z
304
305
305
306
Since addition of several different time units is not commutative, only one
306
307
unit may be passed.
307
308
308
309
my $d = DateTime.new(date => Date.new('2015-02-27'));
309
- say $d.later(month => 1).later(:2day ); # 2015-03-29T00:00:00Z
310
- say $d.later(day => 2).later(:1month); # 2015-04-01T00:00:00Z
311
- say $d.later(day => 2).later(:month); # same, as +True === 1
310
+ say $d.later(month => 1).later(:2days ); # 2015-03-29T00:00:00Z
311
+ say $d.later(days => 2).later(:1month); # 2015-04-01T00:00:00Z
312
+ say $d.later(days => 2).later(:month); # same, as +True === 1
312
313
313
314
Negative offsets are allowed, though L < #method earlier > is more idiomatic for
314
315
that.
0 commit comments