Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 5 Nov 2026. What's built · Install 0.3.0
jadpo
ReferenceTime and calendar

LanguageValues and typesStandard typesTime and calendar

Duration

On this page

An exact length of time, to the millisecond: 90 minutes is PT1H30M.

Use it for timeouts and gaps between two instants. For a month, which has no fixed length, use CalendarPeriod.

Shape

One value, with no fields to fill in. As text it reads PT26H.

Example

example
Duration(90m)

text.parse(raw, as: Duration) reads one from text that comes from outside. Text that isn't one at all fails malformed, such as 5 minutes, P or PT.

This operation gives one: temporal.between.

Good to know

  • In code, write a unit after the number: 500ms, 30s, 90m, 2h, 14d. m is minutes, not metres.
  • temporal.between gives the one between two instants.
  • == tells you whether two are the same, and < and list.sort_by compare and sort them.

In JSON

A string, in a request, a response or json.write:

json
"PT5M""PT1H30M""PT26H"

Details

Text form, storage, how it is shown, and operations

Duration 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: PT5M, PT1H30M and PT26H.

How it is stored

It is stored in one column named for the field, of type bigint. PT1H30M is stored as 5400000.

How it is shown to people

text.format(value, locale:) shows it to people in their locale.

With locale: Locale.en_gb:

Value Shown
PT5M 5 minutes
PT1H30M 1 hour, 30 minutes
PT26H 1 day, 2 hours

Operations

  • temporal.between(start: Instant, end: Instant) -> Duration: How long from start to end: end - start.

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-duration.md.Built from Jadpo main at aee2e8f.