Skip to main content

Duration object

​Properties

​humanReadable

Returns a human readable string of the duration, e.g. - 2d 1h 15m.

​years

Returns an int of the difference in years, e.g. if total duration is 2 years, 4 months and 7 days, this will parse as 2.

​months

Returns an int difference in months, e.g. if total duration is 2 years, 4 months and 7 days, this will parse as 4.

​days

Returns an int difference in days, , e.g. if total duration is 2 years, 3 months and 7 days, this will parse as 7. Durations 1 month or longer will trigger months count and reset the days count back to 0 at each month interval.

​hours

Returns an int difference in hours, e.g. 8.

​minutes

Returns an int difference in minutes, e.g. 22.

​seconds

Returns an int difference in seconds, e.g. 52.