Class: Timestamp
Timestamp class, parses the pattern once, displays the desired Date or UNIX timestamp with the selected pattern.
Constructors
new Timestamp()
new Timestamp(
pattern
:string
):Timestamp
Starts a new Timestamp and parses the pattern.
Parameters
Parameter | Type | Description |
---|---|---|
pattern | string | The pattern to parse |
Returns
Since
1.0.0
Defined in
Properties
pattern
pattern:
string
The raw pattern
Since
1.0.0
Defined in
Methods
display()
display(
time
:TimeResolvable
):string
Display the current date with the current pattern.
Parameters
Parameter | Type | Description |
---|---|---|
time | TimeResolvable | The time to display |
Returns
string
Since
1.0.0
Defined in
displayUTC()
displayUTC(
time
?:TimeResolvable
):string
Display the current date utc with the current pattern.
Parameters
Parameter | Type | Description |
---|---|---|
time ? | TimeResolvable | The time to display in utc |
Returns
string
Since
1.0.0
Defined in
edit()
edit(
pattern
:string
):this
Edits the current pattern.
Parameters
Parameter | Type | Description |
---|---|---|
pattern | string | The new pattern for this instance |
Returns
this
Since
1.0.0
Chainable
Defined in
toString()
toString():
string
Defines the toString behavior of Timestamp.
Returns
string
Defined in
displayArbitrary()
static
displayArbitrary(pattern
:string
,time
:TimeResolvable
):string
Display the current date with the current pattern.
Parameters
Parameter | Type | Description |
---|---|---|
pattern | string | The pattern to parse |
time | TimeResolvable | The time to display |
Returns
string
Since
1.0.0
Defined in
displayUTCArbitrary()
static
displayUTCArbitrary(pattern
:string
,time
:TimeResolvable
):string
Display the current date utc with the current pattern.
Parameters
Parameter | Type | Description |
---|---|---|
pattern | string | The pattern to parse |
time | TimeResolvable | The time to display |
Returns
string
Since
1.0.0
Defined in
utc()
Creates a UTC Date object to work with.
Parameters
Parameter | Type | Description |
---|---|---|
time | string | number | Date | The date to convert to utc |
Returns
Since
1.0.0