The type has the following constructor:
const duration = new Duration(100, 'millisecond');
The second constructor parameter is a measurement unit with the following values:
milliseconds
seconds
minutes
hours
days
const duration = new Duration(100); // 100 milliseconds
const hour = new Duration(1, 'hours'); const day = hour.add(new Duration(23, 'hours'));
Types
Days.
Hours.
Milliseconds.
Minutes.
Seconds.
Add up the durations.
Your review is successfully sent!
Feedback sent successfully
Duration (time)
The type has the following constructor:
const duration = new Duration(100, 'millisecond');The second constructor parameter is a measurement unit with the following values:
millisecondssecondsminuteshoursdaysIf the measurement unit is not specified,the default one is milliseconds.
This type is immutable, so mutation methods return the updated value without changing the original one.const duration = new Duration(100); // 100 millisecondsconst hour = new Duration(1, 'hours'); const day = hour.add(new Duration(23, 'hours'));Types
Hierarchy
Properties
Readonly days
Days.
Readonly hours
Hours.
Readonly milliseconds
Milliseconds.
Readonly minutes
Minutes.
Readonly seconds
Seconds.
Methods
add
Add up the durations.
Parameters
duration: TDuration
Returns TDuration
Feedback sent successfully
Thank you for your input