Skip to content

Interface: ToDateOptions

Options for toDate.

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

optional parseDuration?: boolean

Whether a toDuration expression is read as an instant relative to now, so -7d and 7 days ago become now - 7 days. Defaults to true.

Set false when the value must be a real date and a relative expression should be a miss - a stored timestamp, a user-supplied Date header, an expires_at field - since a duration silently resolving against the current clock makes the same input mean something different on every call. Also what toDuration passes when it recurses, so the two cannot bounce a value between them forever.