InstantRange
The instants from start up to but not including end, written 2026-10-25T09:00:00Z/2026-10-25T17:00:00Z.
Time and calendar; not ordered; since Jadpo 0.1.0.
Make one
Build one from its fields, InstantRange { start: ... end: ... }.
text.parse(raw, as: InstantRange) reads one from its text; text that isn't one at all fails malformed, such as 2026-10-25T09:00:00Z or 2026-10-25T09:00:00Z/tomorrow.
These operations give one: range.intersection, temporal.day_bounds, temporal.month_bounds, temporal.week_bounds and temporal.year_bounds.
Its parts keep these rules; a value that breaks one fails with the rule's name:
start_not_after_end:start <= end
Fields
Text, JSON and storage
text.from writes its canonical text, the one form text.parse reads back. JSON sends an object of its parts.
| Text | JSON |
|---|---|
2026-10-25T09:00:00Z/2026-10-25T17:00:00Z |
{"start":"2026-10-25T09:00:00Z","end":"2026-10-25T17:00:00Z"} |
It is stored in one column named for the field, of type tstzrange. 2026-10-25T09:00:00Z/2026-10-25T17:00:00Z is stored as tstzrange('2026-10-25 09:00:00.000000+00'::timestamptz, '2026-10-25 17:00:00.000000+00'::timestamptz, '[)').
Shown to people
text.format(value, locale:) shows it to people in their locale. A call also gives zone: and format:.
With locale: Locale.en_gb, zone: Zone.europe_london and format: TimeFormat.date_time_medium:
| Value | Shown |
|---|---|
2026-10-25T09:00:00Z/2026-10-25T17:00:00Z |
25 Oct 2026, 09:00:00 – 25 Oct 2026, 17:00:00 |
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.temporal.day_bounds(date: CalendarDate, zone: Zone) -> InstantRange: The instantsdateruns between inzone: 23, 24 or 25 hours.temporal.month_bounds(date: CalendarDate, zone: Zone) -> InstantRange: The month holdingdateinzone.temporal.week_bounds(date: CalendarDate, zone: Zone, starts_on: Weekday) -> InstantRange: The week holdingdateinzone, starting onstarts_on.temporal.year_bounds(date: CalendarDate, zone: Zone) -> InstantRange: The year holdingdateinzone.
Like every standard type, it also has the contract's own operations: text.parse, text.from, text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-instant-range.md.Built from Jadpo main at e00e61f.