API Reference

The object returned when an amount of time is returned by a function. It includes a key/value pair for units of time from seconds to days.

interface Duration {
  days: number
  hours: number
  minutes: number
  seconds: number,
  isGreaterThan: (otherDuration: Duration) => boolean
  isLessThan: (otherDuration: Duration) => boolean
}

// Example:

const durationA = createDuration({
  "days": 6,
  "hours": 8,
  "minutes": 54,
  "seconds": 53,
}
                                 
durationA.days = // 6
durationA.hours = // 8
durationA.minutes // 54
durationA.seconds // 53

const durationB = createDuration({
  "days": 5,
  "hours": 14,
  "minutes": 24,
  "seconds": 2,
}

durationA.isGreaterThan(durationB) //=> true