new Duration()
- Since:
-
- 4.5.0
Members
-
<static, constant> MILLISECONDS_IN_DAY
-
Number of milliseconds in a day.
- Since:
-
- 4.5.0
-
<static, constant> MILLISECONDS_IN_HOUR
-
Number of milliseconds in an hour.
- Since:
-
- 4.5.0
-
<static, constant> MILLISECONDS_IN_MINUTE
-
Number of milliseconds in a minute.
- Since:
-
- 4.5.0
-
<static, constant> MILLISECONDS_IN_MONTH
-
Number of milliseconds in a month (30 days).
- Since:
-
- 4.5.0
-
<static, constant> MILLISECONDS_IN_SECOND
-
Number of milliseconds in a second.
- Since:
-
- 4.5.0
-
<static, constant> MILLISECONDS_IN_WEEK
-
Number of milliseconds in a week.
- Since:
-
- 4.5.0
-
<static, constant> MILLISECONDS_IN_YEAR
-
Number of milliseconds in a non leap year.
- Since:
-
- 4.5.0
-
<static, constant> SECONDS_IN_DAY
-
Number of seconds in a day.
- Since:
-
- 4.5.0
-
<static, constant> SECONDS_IN_HOUR
-
Number of seconds in an hour.
- Since:
-
- 4.5.0
-
<static, constant> SECONDS_IN_MINUTE
-
Number of seconds in a minute.
- Since:
-
- 4.5.0
-
<static, constant> SECONDS_IN_WEEK
-
Number of seconds in a week.
- Since:
-
- 4.5.0
Methods
-
<static> humanize(duration [, unit])
-
Humanises the duration.
Parameters:
Name Type Argument Default Description duration
Number to be humanised.
unit
String <optional>
"ms" the unit level at which to humanise the duration.
- Since:
-
- 4.5.0
Throws:
-
-
for invalid arguments
- Type
- TypeError
-
-
-
for invalid unit string
- Type
- RangeError
-
Returns:
Returns an object with
durationObject
and string representation.- Type
- Object
-
<static> preciseDiff(dateObj1, dateObj2)
-
Parameters:
Name Type Description dateObj1
Date dateObj2
Date