Constructors
constructor
- new Duration(input: undefined | string | number | Partial<{
days: number;
hours: number;
milliseconds: number;
minutes: number;
months: number;
seconds: number;
weeks: number;
years: number;
}>, unit?: DurationUnitType): Duration
-
Parameters
-
input: undefined | string | number | Partial<{
days: number;
hours: number;
milliseconds: number;
minutes: number;
months: number;
seconds: number;
weeks: number;
years: number;
}>
-
Properties
Private
Readonly
#duration
#duration: Duration
Accessors
asDays
- get asDays(): number
-
Returns number
asHours
- get asHours(): number
-
Returns number
asMilliseconds
- get asMilliseconds(): number
-
Returns number
asMinutes
- get asMinutes(): number
-
Returns number
asMonths
- get asMonths(): number
-
Returns number
asSeconds
- get asSeconds(): number
-
Returns number
asWeeks
- get asWeeks(): number
-
Returns number
asYears
- get asYears(): number
-
Returns number
days
- get days(): number
-
Returns number
duration
- get duration(): Duration
-
Returns Duration
hours
- get hours(): number
-
Returns number
humanized
- get humanized(): string
-
Returns string
milliseconds
- get milliseconds(): number
-
Returns number
minutes
- get minutes(): number
-
Returns number
months
- get months(): number
-
Returns number
seconds
- get seconds(): number
-
Returns number
weeks
- get weeks(): number
-
Returns number
years
- get years(): number
-
Returns number
Methods
Private
_duration
- _duration(input?: string | number | Partial<{
days: number;
hours: number;
milliseconds: number;
minutes: number;
months: number;
seconds: number;
weeks: number;
years: number;
}>, unit?: DurationUnitType): Duration
-
Parameters
-
Optional
input: string | number | Partial<{
days: number;
hours: number;
milliseconds: number;
minutes: number;
months: number;
seconds: number;
weeks: number;
years: number;
}>
-
Returns Duration
format
- format(formatStr?: string): string
-
Parameters
-
Optional
formatStr: string
Returns string