Class: Duration
Converts duration strings into ms and future dates
Constructors
new Duration()
new Duration(
pattern
:string
):Duration
Create a new Duration instance
Parameters
Parameter | Type | Description |
---|---|---|
pattern | string | The string to parse |
Returns
Defined in
duration/dist/esm/index.d.mts:107
Properties
days
days:
number
The amount of days extracted from the text.
Defined in
duration/dist/esm/index.d.mts:90
hours
hours:
number
The amount of hours extracted from the text.
Defined in
duration/dist/esm/index.d.mts:86
microseconds
microseconds:
number
The amount of microseconds extracted from the text.
Defined in
duration/dist/esm/index.d.mts:70
milliseconds
milliseconds:
number
The amount of milliseconds extracted from the text.
Defined in
duration/dist/esm/index.d.mts:74
minutes
minutes:
number
The amount of minutes extracted from the text.
Defined in
duration/dist/esm/index.d.mts:82
months
months:
number
The amount of months extracted from the text.
Defined in
duration/dist/esm/index.d.mts:98
nanoseconds
nanoseconds:
number
The amount of nanoseconds extracted from the text.
Defined in
duration/dist/esm/index.d.mts:66
offset
offset:
number
The offset
Defined in
duration/dist/esm/index.d.mts:62
seconds
seconds:
number
The amount of seconds extracted from the text.
Defined in
duration/dist/esm/index.d.mts:78
weeks
weeks:
number
The amount of weeks extracted from the text.
Defined in
duration/dist/esm/index.d.mts:94
years
years:
number
The amount of years extracted from the text.
Defined in
duration/dist/esm/index.d.mts:102
aAndAnRegex
private
readonly
static
aAndAnRegex:any
The RegExp used for replacing a/an with 1
Defined in
duration/dist/esm/index.d.mts:128
commaRegex
private
readonly
static
commaRegex:any
The RegExp used for removing commas
Defined in
duration/dist/esm/index.d.mts:124
patternRegex
private
readonly
static
patternRegex:any
The RegExp used for the pattern parsing
Defined in
duration/dist/esm/index.d.mts:120
Accessors
fromNow
Get Signature
get fromNow():
Date
Get the date from now
Returns
Defined in
duration/dist/esm/index.d.mts:111
Methods
dateFrom()
Get the date from
Parameters
Parameter | Type | Description |
---|---|---|
date | Date | The Date instance to get the date from |
Returns
Defined in
duration/dist/esm/index.d.mts:116