API Reference

Returns a Duration representing the amount of time between two dates.

function durationFromDates(dateA: Date, dateB: Date)

// Example:

const now = new Date()
const fiveMinutesAgo = new Date(Date.now() - 60 * 1000 * 5)

durationFromDates(now, fiveMinutesAgo)
//=> { days: 0, hours: 0, minutes: 5, seconds: 0 }