Class: Timestamp
Defined in: timestamp/dist/esm/index.d.mts:25
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
Defined in: timestamp/dist/esm/index.d.mts:40
Starts a new Timestamp and parses the pattern.
Parameters
Parameter | Type | Description |
---|---|---|
pattern | string | The pattern to parse |
Returns
Since
1.0.0
Properties
pattern
pattern:
string
Defined in: timestamp/dist/esm/index.d.mts:30
The raw pattern
Since
1.0.0
template
private
template:any
Defined in: timestamp/dist/esm/index.d.mts:34
Since
1.0.0
display
private
static
display:any
Defined in: timestamp/dist/esm/index.d.mts:90
Display the current date with the current pattern.
Since
1.0.0
Param
The pattern to parse
Param
The time to display
parse
private
static
parse:any
Defined in: timestamp/dist/esm/index.d.mts:96
Parses the pattern.
Since
1.0.0
Param
The pattern to parse
resolveDate
private
static
resolveDate:any
Defined in: timestamp/dist/esm/index.d.mts:102
Resolves a date.
Since
1.0.0
Param
The time to parse
Methods
display()
display(
time
?:TimeResolvable
):string
Defined in: timestamp/dist/esm/index.d.mts:46
Display the current date with the current pattern.
Parameters
Parameter | Type | Description |
---|---|---|
time ? | TimeResolvable | The time to display |
Returns
string
Since
1.0.0
displayUTC()
displayUTC(
time
?:TimeResolvable
):string
Defined in: timestamp/dist/esm/index.d.mts:52
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
edit()
edit(
pattern
:string
):this
Defined in: timestamp/dist/esm/index.d.mts:59
Edits the current pattern.
Parameters
Parameter | Type | Description |
---|---|---|
pattern | string | The new pattern for this instance |
Returns
this
Since
1.0.0
Chainable
toString()
toString():
string
Defined in: timestamp/dist/esm/index.d.mts:63
Defines the toString behavior of Timestamp.
Returns
string
displayArbitrary()
static
displayArbitrary(pattern
:string
,time
?:TimeResolvable
):string
Defined in: timestamp/dist/esm/index.d.mts:70
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
displayUTCArbitrary()
static
displayUTCArbitrary(pattern
:string
,time
?:TimeResolvable
):string
Defined in: timestamp/dist/esm/index.d.mts:77
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
utc()
Defined in: timestamp/dist/esm/index.d.mts:83
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