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, 'hour'); const day = hour.add(new Duration(23, 'hour'));
Types
Days.
Hours.
Milliseconds.
Minutes.
Seconds.
Add up the durations.
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, 'hour'); const day = hour.add(new Duration(23, 'hour'));Types