Class: Timestamp
Defined in: Timestamp.ts:125
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.ts:142
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.ts:130
The raw pattern
Since
1.0.0
template
private
template:TimestampTemplateEntry
[]
Defined in: Timestamp.ts:135
Since
1.0.0
Methods
display()
display(
time
:TimeResolvable
):string
Defined in: Timestamp.ts:152
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.ts:161
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.ts:171
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.ts:180
Defines the toString behavior of Timestamp.
Returns
string
display()
private
static
display(template
:TimestampTemplateEntry
[],time
:string
|number
|Date
):string
Defined in: Timestamp.ts:220
Display the current date with the current pattern.
Parameters
Parameter | Type | Description |
---|---|---|
template | TimestampTemplateEntry [] | The pattern to parse |
time | string | number | Date | The time to display |
Returns
string
Since
1.0.0
displayArbitrary()
static
displayArbitrary(pattern
:string
,time
:TimeResolvable
):string
Defined in: Timestamp.ts:190
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.ts:200
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
parse()
private
static
parse(pattern
:string
):TimestampTemplateEntry
[]
Defined in: Timestamp.ts:232
Parses the pattern.
Parameters
Parameter | Type | Description |
---|---|---|
pattern | string | The pattern to parse |
Returns
Since
1.0.0
resolveDate()
private
static
resolveDate(time
:TimeResolvable
):Date
Defined in: Timestamp.ts:261
Resolves a date.
Parameters
Parameter | Type | Description |
---|---|---|
time | TimeResolvable | The time to parse |
Returns
Since
1.0.0
utc()
Defined in: Timestamp.ts:209
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