Skip to content

duration/calculate

  • The core functions, which every industry uses.
  • absDuration: Return the absolute value of an ISO 8601 duration string.
  • addDuration: Combine two ISO 8601 duration strings by addition.
  • durationFromUnits: Write an amount given as a unit object, such as { minutes: 15 }, as an ISO 8601 duration string.
  • getDurationSign: Report whether an ISO 8601 duration is negative, zero-length, or positive.
  • getDurationUnit: Read a single component out of an ISO 8601 duration string.
  • negateDuration: Flip the sign of an ISO 8601 duration string.
  • subtractDuration: Combine two ISO 8601 duration strings by subtraction.
  • totalDuration: Express an ISO 8601 duration as a single fractional total in one unit.
  • totalUnits: Express an amount written as a unit object, such as { minutes: 15 }, as a single fractional total in one unit.
  • totalUnitsFromNow: Express a length of time from now as one fractional total in one unit.
  • ttlFromNow: Express one length of time from now in every form a receiver wants: seconds, milliseconds, a Unix epoch, an HTTP date and a UTC string.
  • ExactDurationUnit: The plural name of a duration field that has an exact length: "days", or a time field from "hours" down to "nanoseconds".
  • Ttl: One length from now, in each form a receiver wants.

Last updated:

Accessibility
© 2026 NorthGuild · Licences

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.