Skip to content

Interface: ToDurationOptions

Options for toDuration.

The mirror of ToDateOptions: each function can fall back to the other, so each has one switch turning that fallback off.

optional parseDate?: boolean

Whether a toDate value is read as the signed offset from now, so 2026-08-02 becomes however long until (or since) that instant. Defaults to true.

Set false when only a length of time is meaningful - a timeout, a poll interval, a cache TTL - because a date would otherwise yield a plausible but wrong number that also drifts with the clock. Also what toDate passes when it recurses.