Skip to content

Commit 13b934d

Browse files
committed
Add to DateTime.later/.earlier
- Note behaviour with leap seconds spec: Raku/roast@66d29b7aa8 - Note negatives work with `earlier` - Change links to work on routine-specific pages too, not just the type pages
1 parent 6c5e0ca commit 13b934d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

doc/Type/DateTime.pod6

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,13 @@ unit may be passed.
281281
say $d.later(days => 2).later(:1month); # OUTPUT: «2015-04-01T00:00:00Z␤»
282282
say $d.later(days => 2).later(:month); # same, as +True === 1
283283
284-
Negative offsets are allowed, though L<#method earlier> is more idiomatic for
285-
that.
284+
If the resultant time has value C<60> for seconds, yet no leap second
285+
actually exists for that time, seconds will be set to C<59>:
286+
287+
say DateTime.new('2008-12-31T23:59:60Z').later: :1day;
288+
# OUTPUT: «2009-01-01T23:59:59Z␤»
289+
290+
Negative offsets are allowed, though L<earlier> is more idiomatic for that.
286291
287292
=head2 method earlier
288293
@@ -296,6 +301,14 @@ towards the past applied. See L<#method later> for usage.
296301
my $d = DateTime.new(date => Date.new('2015-02-27'));
297302
say $d.earlier(month => 1).earlier(:2days); # OUTPUT: «2015-01-25T00:00:00Z␤»
298303
304+
If the resultant time has value C<60> for seconds, yet no leap second
305+
actually exists for that time, seconds will be set to C<59>:
306+
307+
say DateTime.new('2008-12-31T23:59:60Z').earlier: :1day;
308+
# OUTPUT: «2008-12-30T23:59:59Z␤»
309+
310+
Negative offsets are allowed, though L<later> is more idiomatic for that.
311+
299312
=head2 method truncated-to
300313
301314
Defined as:

0 commit comments

Comments
 (0)