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 it- 20
From 6.e
Date.DateTimehonours:timezone; before 6.e it drops it.Date.new(2026,1,1).DateTime(:timezone(3600)).timezoneis 3600 under 6.e and 0 under 6.d - 29
The
nanoterm exists only from 6.e and is an Int of nanoseconds.nano ~~ Intis 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 passes- 9
A DateTime built from a timestamp ending in
Ztakes a:timezoneargument.
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 passes- 6
.to-posixon an Instant undoes exactly the offset thatInstant.from-posix,nowand.Instantapply, 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 passes- 5
A subclass of DateTime does DateTime arithmetic with
-and+rather than numifying, and its.later,.in-timezoneand.cloneanswer the subclass.
More from this test: Classes, roles & the MOP (3).
date-compares-by-daycountRaku++ passesRakudo passesdate-formatter-everywhereRaku++ passesRakudo passes- 1
A Date or DateTime built with
:formatter(&code)renders through that formatter in every stringification:.Str,.gist, prefix~,eqandsprintf "%s".with a
yyyymmddformatter,$d eq '20151229'isTrue - 2
A Date derived from one with a formatter keeps it:
.succ,.pred,+/-,.later,.earlier,.truncated-to,.first-date-in-month,.last-date-in-monthand Range iteration.
date-new-instant-dateishRaku++ passesRakudo passesdate-new-ymd-stringsRaku++ passesRakudo passes- 1
Date.newaccepts three numeric strings as year, month and day; only a single non-ISO string positional raisesX::Temporal::InvalidFormat.Date.new('2018', '1', '4')is legal
datetime-components-and-exactnessRaku++ passesRakudo passes- 1
DateTime.new(date => Date.new(…), hour => 1)takes its year, month and day from thedateargument. - 2
Fractional seconds of a DateTime parse as a
Rat, so.day-fraction,.julian-dateand.modified-julian-datestay rational.seconds written
:00.43are 43/100 - 3
DateTimehas.days-in-year,.offset-in-minutes,.offset-in-hoursand.posix(:real). inferred - 4
An unset
DateTime.formatteris theCallabletype object. - 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 passesdatetime-timer-clockRaku++ passesRakudo passes- 1
A DateTime and the Instant naming the same moment are the same moment to every timer:
sleep-until(DateTime)waits andPromise.at(DateTime)is kept at that time, exactly as with the Instant.
dist-suite-quartetRaku++ passesRakudo passes- 17
DateTime.nowcarries 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 passes- 2
A DateTime
:formattermay 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))isF-2020 - 3
The DateTime conversions
.utc,.clone,.in-timezone,.laterand.earlierkeep the formatter.
More from this test: Classes, roles & the MOP (1), Signatures & dispatch (1).
duration-slip-fail-destructureRaku++ passesRakudo cannot run it- 1
-$dandabs $don a Duration are Durations. - 2
A Real minus or modulo a Duration or an Instant is a Num, and prefix
-on an Instant is a Num.0 - $dfor a Duration$dis 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 passes- 4
sleep-until $instantreturns whether it actually waited.
More from this test: Concurrency (1), Lists & laziness (3).
instant-rat-and-nested-rakuRaku++ passesRakudo passes- 1
An Instant holds a Rat whatever made it, from
Instant.from-posixwith an Int or fromDateTime.new(0).Instant.Instant.from-posix(10) eqv Instant.from-posix(10.0)is True - 2
An Instant's
.rakuisInstant.from-posix(…)when it is nested in a Pair, Array or Hash as well as at the top. - 3
A Duration nested in a Pair, Array or Hash renders in
.rakuas a Duration, not as its bare number. inferred
issue-208-temporal-string-shapeRaku++ passesRakudo passes- 1
DateTime.newandDate.newgiven a string that is not an ISO 8601 timestamp or date throw X::Temporal::InvalidFormat, and so do the coercions.DateTime,.DateandDateTime('').DateTime.new('')throws, as do2020-01-01,2020-1-1,999-01-01,2020-01-01T10:00and2020-01-01 10:00:00 - 2
A date string is
yyyy-mm-ddwith a year of four digits or more, signed or not; a DateTime string may addThh:mm:ss, a fraction of 1 to 12 digits after.or,, andZor±hh,±hhmm,±hh:mm. - 3
Date.newrefuses a full timestamp string.
leap-second-in-timezoneRaku++ passesRakudo passes- 1
.in-timezonewith 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 passes- 6
Date.new-from-daycount,Date.first-date-in-monthandInstant.to-posixare 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 passes- 1
nowis an Instant holding an exact Rat of nanoseconds, so its.rakureads backeqvto it.
roast-3log-batch1Raku++ passesRakudo passes- 6
$t += $dwith 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 passes- 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 passes- 2
The core
DateandDateTimeconstructors throwX::Temporal::OutOfRangefor an out-of-range field, sowhen X::Temporal::OutOfRangematches.
More from this test: Exceptions & control flow (1).
temporal-str-field-refusedRaku++ passesRakudo passes- 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
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
A numeric Str given as a Date or DateTime field is taken as its number.
temporal-string-digits-and-rangesRaku++ passesRakudo passes- 1
Date and DateTime strings take any Unicode decimal digit.
Date.new("٢٠١٠-٠١-٠٢")is 2010-01-02 - 2
X::Temporal::OutOfRange carries
.gotas an Int,.rangeas a Str and a.commentattribute that is unset. - 3
A timezone offset's minutes out of range are reported as the timezone's minutes, with
.gota Rat."minutes of timezone out of range. Is: 99, should be in 0..^60"
uni-and-date-renderingRaku++ passesRakudo passes- 3
The ISO 8601 rendering of a date-time is the same from
.Str,.gistand.yyyy-mm-dd-style formatting, with a+prefix for years beyond 9999, a±HH:MMoffset suffix and fractional seconds. inferred
More from this test: Stringification (2).