LanguageValues and typesStandard typesTime and calendar
DateRange
On this page
The days from one date to another, both included: 2026-10-01/2026-10-31.
Use it for bookings, holidays and reporting periods. For moments, use InstantRange, which leaves out its end. For a range of any other ordered type, use Range.
Shape
| Field | Type | Required? |
|---|---|---|
start |
CalendarDate |
Yes |
end |
CalendarDate |
Yes |
Its parts keep these rules, and a value that breaks one fails with the rule's name:
start_not_after_end: start <= end
Example
DateRange { start: "2026-10-01" end: "2026-10-31" }text.parse(raw, as: DateRange) reads one from text that comes from outside. Text that isn't one at all fails malformed, such as 2026-10-31/2026-10-01, 2026-10-01 or 2026-10-01/...
This operation gives one: range.intersection.
Good to know
- Unlike every other range, the last day counts: a one-day range has
startandendon the same date. range.contains,range.overlapsandrange.intersectionwork on it.==tells you whether two are the same.<andlist.sort_bydon't take it, so sort by one of its parts instead.
In JSON
An object of its parts, in a request, a response or json.write:
{"start":"2026-10-01","end":"2026-10-31"}{"start":"2026-10-25","end":"2026-10-25"}
Details
Text form, storage, how it is shown, and operations
DateRange is in the group Time and calendar, and has been in Jadpo since 0.1.0.
Text form
text.from writes one standard text form, the same form text.parse reads back: 2026-10-01/2026-10-31 and 2026-10-25/2026-10-25.
How it is stored
It is stored in one column named for the field, of type daterange. 2026-10-25/2026-10-25 is stored as daterange('2026-10-25'::date, '2026-10-25'::date, '[]').
How it is shown to people
text.format(value, locale:) shows it to people in their locale. A call also gives format:.
With locale: Locale.en_gb and format: TimeFormat.date_medium:
| Value | Shown |
|---|---|
2026-10-01/2026-10-31 |
1 Oct 2026 – 31 Oct 2026 |
2026-10-25/2026-10-25 |
25 Oct 2026 – 25 Oct 2026 |
Operations
range.contains(range: Range<T>, value: T) -> Bool: Whethervalueis insiderange.range.intersection(a: Range<T>, b: Range<T>) -> Range<T>?: The partaandbshare;nonewhen they don't overlap.range.overlaps(a: Range<T>, b: Range<T>) -> Bool: Whetheraandbshare at least one value.
It also takes text.parse, text.from, text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-date-range.md.Built from Jadpo main at aee2e8f.