Get the hours.
Get the milliseconds.
et the minutes.
Get the months.
Get the seconds.
Get the weeks.
Get the years.
Optional
unit: DurationUnitGet the value of unit.
Duration.fromObject({years: 2, days: 3}).get('years') // 2
Duration.fromObject({years: 2, days: 3}).get('months') // 0
Duration.fromObject({years: 2, days: 3}).get('days') // 3
a unit such as 'minute' or 'day'
Returns an ISO 8601-compliant string representation of this Duration.
https://en.wikipedia.org/wiki/ISO_8601#Durations
Duration.fromObject({ years: 3, seconds: 45 }).toString() // 'P3YT45S'
Duration.fromObject({ months: 4, seconds: 45 }).toString() // 'P4MT45S'
Duration.fromObject({ months: 5 }).toString() // 'P5M'
Duration.fromObject({ minutes: 5 }).toString() // 'PT5M'
Duration.fromObject({ milliseconds: 6 }).toString() // 'PT0.006S'
Optional
days?: numberOptional
hours?: numberOptional
milliseconds?: numberOptional
minutes?: numberOptional
months?: numberOptional
seconds?: numberOptional
weeks?: numberOptional
years?: numberStatic
fromISOCreate a Duration from an ISO 8601 duration string.
Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject()
// { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }
Duration.fromISO('PT23H').toObject()
// { hours: 23 }
Duration.fromISO('P5Y3M').toObject()
// { years: 5, months: 3 }
Generated using TypeDoc
Get the days.