Raku Cases › Dates & times

Dates & times

Date, DateTime, Instant, Duration.

45 rules from 26 tests. 24 of those tests are confirmed on both engines: Raku++ and Rakudo 2026.11 both pass, or Raku++ gives Rakudo's answer on every probe of a family. The verdict is the test's, not each rule's. How to read a case.

6e-gatingRaku++ passesRakudo cannot run it2026-08-19 · 387d2c88
  1. 20

    From 6.e Date.DateTime honours :timezone; before 6.e it drops it.

    Date.new(2026,1,1).DateTime(:timezone(3600)).timezone is 3600 under 6.e and 0 under 6.d

  2. 29

    The nano term exists only from 6.e and is an Int of nanoseconds.

    nano ~~ Int is True under 6.e and "Undefined routine" under 6.d

More from this test: Exceptions & control flow (1), Hashes & sets (3), I/O & processes (2), Lists & laziness (8), Numerics (1), Classes, roles & the MOP (2), Operators (1), Everything else (2), Regexes & grammars (2), Scoping & phasers (2), Signatures & dispatch (1), Strings & Unicode (6), divergences (1).

audited-language-gaps-2Raku++ passesRakudo passes2026-10-04 · 39c1aeb6
  1. 9

    A DateTime built from a timestamp ending in Z takes a :timezone argument.

More from this test: Compile-time errors (2), Containers & assignment (1), Lists & laziness (3), Operators (1), Regexes & grammars (2), Strings & Unicode (2), Types & coercion (1).

bson-simple-and-hash-agnosticRaku++ passesRakudo passes2026-08-31 · 2d04edb3
  1. 6

    .to-posix on an Instant undoes exactly the offset that Instant.from-posix, now and .Instant apply, so the conversions round-trip. inferred

More from this test: Containers & assignment (4), Hashes & sets (1), Modules (1), Classes, roles & the MOP (2), Operators (1), Signatures & dispatch (2), Stringification (1), Strings & Unicode (1), Types & coercion (1).

core-class-extended-in-placeRaku++ passesRakudo passes2026-10-27 · d5184116
  1. 5

    A subclass of DateTime does DateTime arithmetic with - and + rather than numifying, and its .later, .in-timezone and .clone answer the subclass.

More from this test: Classes, roles & the MOP (3).

date-compares-by-daycountRaku++ passesRakudo passes2026-08-26 · 13e97d1b
  1. 1

    Two Dates naming the same day compare equal however they were made.

    DateTime.now.Date == Date.today is True

  2. 2

    A Date numifies to its daycount, and a DateTime to its Instant.

    +$date is the daycount

date-formatter-everywhereRaku++ passesRakudo passes2026-09-15 · d5b38857
  1. 1

    A Date or DateTime built with :formatter(&code) renders through that formatter in every stringification: .Str, .gist, prefix ~, eq and sprintf "%s".

    with a yyyymmdd formatter, $d eq '20151229' is True

  2. 2

    A Date derived from one with a formatter keeps it: .succ, .pred, +/-, .later, .earlier, .truncated-to, .first-date-in-month, .last-date-in-month and Range iteration.

date-new-instant-dateishRaku++ passesRakudo passes2026-09-15 · 6f5585a3 · #88
  1. 1

    Date.new(Instant) takes the UTC day of that instant.

    Date.new(now) is today's UTC date

  2. 2

    Date.new(Dateish) copies the civil year, month and day, so a DateTime at 01:00 in +02:00 gives that local date, not the UTC one.

date-new-ymd-stringsRaku++ passesRakudo passes2026-07-22 · 60a51a27
  1. 1

    Date.new accepts three numeric strings as year, month and day; only a single non-ISO string positional raises X::Temporal::InvalidFormat.

    Date.new('2018', '1', '4') is legal

datetime-components-and-exactnessRaku++ passesRakudo passes2026-07-26 · b58e2c3d
  1. 1

    DateTime.new(date => Date.new(…), hour => 1) takes its year, month and day from the date argument.

  2. 2

    Fractional seconds of a DateTime parse as a Rat, so .day-fraction, .julian-date and .modified-julian-date stay rational.

    seconds written :00.43 are 43/100

  3. 3

    DateTime has .days-in-year, .offset-in-minutes, .offset-in-hours and .posix(:real). inferred

  4. 4

    An unset DateTime.formatter is the Callable type object.

  5. 5

    A leap second (:60) exists only on the day it was inserted; DateTime arithmetic that moves to another day clamps it to :59.

datetime-number-is-instantRaku++ passesRakudo passes2026-10-27 · 50aebf54
  1. 1

    A DateTime is its Instant in arithmetic and comparison with a plain number, and only a Duration moves a DateTime.

    DateTime.new(0) + 60 is Instant:70, and $d * 2 is the Num 20

  2. 2

    div between a DateTime and a number is refused, and mod answers an Instant. inferred

datetime-timer-clockRaku++ passesRakudo passes2026-09-01 · 8ba790ac
  1. 1

    A DateTime and the Instant naming the same moment are the same moment to every timer: sleep-until(DateTime) waits and Promise.at(DateTime) is kept at that time, exactly as with the Instant.

dist-suite-quartetRaku++ passesRakudo passes2026-08-05 · 4e2c20cd
  1. 17

    DateTime.now carries fractional seconds.

More from this test: Exceptions & control flow (1), I/O & processes (1), Classes, roles & the MOP (4), Operators (1), Everything else (1), Regexes & grammars (2), Scoping & phasers (1), Signatures & dispatch (2), Stringification (1), Syntax & parsing (3), Types & coercion (2).

dot-method-call-and-formatterRaku++ passesRakudo passes2026-08-04 · e376ad98
  1. 2

    A DateTime :formatter may be any object that does Callable, not only a Code.

    with class F does Callable { method CALL-ME($d) { "F-{$d.year}" } }, ~DateTime.new(:2020year, :1month, :2day, :formatter(F.new)) is F-2020

  2. 3

    The DateTime conversions .utc, .clone, .in-timezone, .later and .earlier keep the formatter.

More from this test: Classes, roles & the MOP (1), Signatures & dispatch (1).

duration-slip-fail-destructureRaku++ passesRakudo cannot run it2026-10-22 · 3e97932e
  1. 1

    -$d and abs $d on a Duration are Durations.

  2. 2

    A Real minus or modulo a Duration or an Instant is a Num, and prefix - on an Instant is a Num.

    0 - $d for a Duration $d is a Num, not a Duration

More from this test: Containers & assignment (1), Exceptions & control flow (1), Lists & laziness (2).

flat-squish-and-exit-from-a-workerRaku++ passesRakudo passes2026-07-26 · efafccfc
  1. 4

    sleep-until $instant returns whether it actually waited.

More from this test: Concurrency (1), Lists & laziness (3).

instant-rat-and-nested-rakuRaku++ passesRakudo passes2026-10-09 · d59e9566
  1. 1

    An Instant holds a Rat whatever made it, from Instant.from-posix with an Int or from DateTime.new(0).Instant.

    Instant.from-posix(10) eqv Instant.from-posix(10.0) is True

  2. 2

    An Instant's .raku is Instant.from-posix(…) when it is nested in a Pair, Array or Hash as well as at the top.

  3. 3

    A Duration nested in a Pair, Array or Hash renders in .raku as a Duration, not as its bare number. inferred

issue-208-temporal-string-shapeRaku++ passesRakudo passes2026-10-28 · 0f19ab0e · #208
  1. 1

    DateTime.new and Date.new given a string that is not an ISO 8601 timestamp or date throw X::Temporal::InvalidFormat, and so do the coercions .DateTime, .Date and DateTime('').

    DateTime.new('') throws, as do 2020-01-01 , 2020-1-1, 999-01-01, 2020-01-01T10:00 and 2020-01-01 10:00:00

  2. 2

    A date string is yyyy-mm-dd with a year of four digits or more, signed or not; a DateTime string may add Thh:mm:ss, a fraction of 1 to 12 digits after . or ,, and Z or ±hh, ±hhmm, ±hh:mm.

  3. 3

    Date.new refuses a full timestamp string.

leap-second-in-timezoneRaku++ passesRakudo passes2026-11-13 · bfd530f9 · rakudo#2097
  1. 1

    .in-timezone with an offset that is not a whole number of minutes keeps a leap second as second 60 and shifts the minute.

    DateTime.new('2016-12-31T23:59:60Z').in-timezone(514) gives 00:08:60

missing-routines-batchRaku++ passesRakudo passes2026-07-26 · 8782278a
  1. 6

    Date.new-from-daycount, Date.first-date-in-month and Instant.to-posix are available. inferred

More from this test: Hashes & sets (1), Lists & laziness (3), Regexes & grammars (1), Stringification (1), Strings & Unicode (1).

now-is-exact-ratRaku++ passesRakudo passes2026-11-08 · 4c49bc3e
  1. 1

    now is an Instant holding an exact Rat of nanoseconds, so its .raku reads back eqv to it.

roast-3log-batch1Raku++ passesRakudo passes2026-09-28 · ea9f1388
  1. 6

    $t += $d with a Duration on the left keeps a Duration.

More from this test: Exceptions & control flow (2), Hashes & sets (1), I/O & processes (3), Lists & laziness (2).

scalars-nil-junction-complex-dateRaku++ passesRakudo passes2026-07-27 · ebbe10f3
  1. 9

    Date.new(y, m, *) is the last day of that month.

More from this test: Concurrency (1), Containers & assignment (1), Numerics (3), Classes, roles & the MOP (1), Operators (1), Everything else (1), Stringification (1), Syntax & parsing (1), Types & coercion (1).

temporal-out-of-rangeRaku++ passesRakudo passes2026-09-15 · 02003b9f
  1. 2

    The core Date and DateTime constructors throw X::Temporal::OutOfRange for an out-of-range field, so when X::Temporal::OutOfRange matches.

More from this test: Exceptions & control flow (1).

temporal-str-field-refusedRaku++ passesRakudo passes2026-11-09 · e8a8ba53
  1. 1

    A Date or DateTime field given as a Str that is no number is refused: an X::AdHoc from unboxing it, or for a second an out-of-range error.

    Date.new(2015, "x", 1) dies instead of reading the month as 0

  2. 2

    A timezone given to DateTime as a Str is read as a field's value beside other fields and is refused beside a timestamp, a POSIX time or .now. inferred

  3. 3

    A numeric Str given as a Date or DateTime field is taken as its number.

temporal-string-digits-and-rangesRaku++ passesRakudo passes2026-11-08 · de67ca59
  1. 1

    Date and DateTime strings take any Unicode decimal digit.

    Date.new("٢٠١٠-٠١-٠٢") is 2010-01-02

  2. 2

    X::Temporal::OutOfRange carries .got as an Int, .range as a Str and a .comment attribute that is unset.

  3. 3

    A timezone offset's minutes out of range are reported as the timezone's minutes, with .got a Rat.

    "minutes of timezone out of range. Is: 99, should be in 0..^60"

uni-and-date-renderingRaku++ passesRakudo passes2026-07-28 · fd043afc
  1. 3

    The ISO 8601 rendering of a date-time is the same from .Str, .gist and .yyyy-mm-dd-style formatting, with a + prefix for years beyond 9999, a ±HH:MM offset suffix and fractional seconds. inferred

More from this test: Stringification (2).