ChronosChronos

diff

Get difference between 2 dates in specified unit

diff()

Returns the difference between current and another date in the given unit.

Signature

diff(other: ChronosInput, unit: TimeUnit): number

Parameters

  • other: Date to compare with
  • unit: Unit for difference. Defaults to 'millisecond'.

Return Type

number - Difference in specified units

Note

Returns signed difference (negative if other is after this date)

Example

playground.ts

Last updated: Thu, May 21, 2026 03:14:59PM (UTC)

On this page