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.
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:
milliseconds
seconds
minutes
hours
days
If 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 milliseconds
const hour = new Duration(1, 'hours'); const day = hour.add(new Duration(23, 'hours'));
Types