@@ -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(days => 20); # 2015-12-11T16:01:00Z
32
+ say $dt.later(day => 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,23 +293,22 @@ 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 < 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 > .
296
+ Allowed units are C < second > , C < minute > , C < hour > , C < day > , C < week > , C < month > ,
297
+ C < year > .
299
298
300
299
Please note that the special ":2nd" named parameter syntax can be a compact
301
300
and self-documenting way of specifying the delta
302
301
303
- say DateTime.new('2015-12-24T12:23:00Z').later(:2years );
302
+ say DateTime.new('2015-12-24T12:23:00Z').later(:2year );
304
303
# 2017-12-24T12:23:00Z
305
304
306
305
Since addition of several different time units is not commutative, only one
307
306
unit may be passed.
308
307
309
308
my $d = DateTime.new(date => Date.new('2015-02-27'));
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
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
313
312
314
313
Negative offsets are allowed, though L < #method earlier > is more idiomatic for
315
314
that.
0 commit comments