Skip to main content
Temporal.DifferenceOptions.roundingMode - Temporal - Web documentation
property Temporal.DifferenceOptions.roundingMode

Controls how rounding is performed:

  • halfExpand: Round to the nearest of the values allowed by roundingIncrement and smallestUnit. When there is a tie, round away from zero like ceil for positive durations and like floor for negative durations.
  • ceil: Always round up, towards the end of time.
  • trunc: Always round down, towards the beginning of time. This mode is the default.
  • floor: Also round down, towards the beginning of time. This mode acts the same as trunc, but it's included for consistency with Temporal.Duration.round() where negative values are allowed and trunc rounds towards zero, unlike floor which rounds towards negative infinity which is usually unexpected. For this reason, trunc is recommended for most use cases.

Type