Moritz (>):
> iirc there was a spec change.
>
> Let's check...
>
> $ ~/p6/specs (master)$ git log -p -S truncated
> commit 9d8bc5fe62dd38805d791c0351c85185d351290e
> Author: Carl Masak <cma...@gmail.com>
> Date:   Thu Jan 24 18:27:55 2013 +0100
>
>     [S32/Temporal] spec DateTime.delta and Date.delta
>
>     Clarify the .truncated-to method as well; it also uses the
>     C<TimeUnit> enum, instead of named parameters.

But that spec change has since been superseded by a newer, much better one:

$ git show 337f4
commit 337f433398a070884e3258fc724c3b5f775fe085
Author: Carl Masak <cma...@gmail.com>
Date:   Sat May 10 20:34:03 2014 +0200

    [S32/Temporal] retire TimeUnit enum and .delta

    Use strings in .truncate-to instead.

    .delta now becomes .later and .earlier, and they expect string keys as named
    arguments.

[...]

     my $dt = DateTime.new('2005-02-01T15:20:35Z');
-    say $dt.truncated-to(hour); # 2005-02-01T15:00:00Z
+    say $dt.truncated-to('hour'); # 2005-02-01T15:00:00Z

[...]

-The C<delta> constructor allows you to move a number of C<TimeUnit>s forward or
-backward in time.
+The C<later> and C<earlier> constructors allows you to move a number of time
+units forward or backward in time.

-    $dt.delta(44, minutes);
-    $dt.delta(-1, week);
+    $dt.later(minutes => 44);
+    $dt.earlier(week => 1);
+
+(Both C<later> and C<earlier> accept zero or negative integers, with
the obvious
+extended semantics.)

[...]

(end of diff)

...and that's how .truncated-to got its string argument. The end.

// Carl

Reply via email to