Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

intervalToDuration

import { intervalToDuration } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// Get the duration between January 15, 1929 and April 4, 1968.
intervalToDuration({
  start: new Date(1929, 0, 15, 12, 0, 0),
  end: new Date(1968, 3, 4, 19, 5, 0)
})
// => { years: 39, months: 2, days: 20, hours: 7, minutes: 5, seconds: 0 }
function intervalToDuration<DateType extends Date>(interval: Interval<DateType>): Duration;
§
intervalToDuration<DateType extends Date>(interval: Interval<DateType>): Duration
[src]

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
interval: Interval<DateType>
[src]
  • The interval to convert to duration

§Return Type

§

The duration object