@mcsb/api / Exports / UnixDate
Class: UnixDate
An extension of Date which overrides the toJSON
function to return the unix timestamp value (Date.getTime()
) instead of an ISO 8601 string. This can be used to avoid pre-/post-processing on stringified objects. Specifically, this is used by Starboard to easily convert Hypixel API unix timestamps back into timestamps after stringifying, so the output mirrors that of the Hypixel API.
Hierarchy
Date
↳
UnixDate
Table of contents
Constructors
Methods
Constructors
constructor
• new UnixDate()
Inherited from
Date.constructor
Defined in
node_modules/typescript/lib/lib.es5.d.ts:917
• new UnixDate(value
)
Parameters
Name | Type |
---|---|
value | string | number |
Inherited from
Date.constructor
Defined in
node_modules/typescript/lib/lib.es5.d.ts:918
• new UnixDate(year
, monthIndex
, date?
, hours?
, minutes?
, seconds?
, ms?
)
Creates a new Date.
Parameters
Name | Type | Description |
---|---|---|
year | number | The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. |
monthIndex | number | The month as a number between 0 and 11 (January to December). |
date? | number | The date as a number between 1 and 31. |
hours? | number | Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. |
minutes? | number | Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. |
seconds? | number | Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. |
ms? | number | A number from 0 to 999 that specifies the milliseconds. |
Inherited from
Date.constructor
Defined in
node_modules/typescript/lib/lib.es5.d.ts:929
• new UnixDate(value
)
Parameters
Name | Type |
---|---|
value | string | number | Date |
Inherited from
Date.constructor
Defined in
node_modules/typescript/lib/lib.es2015.core.d.ts:88
Methods
toJSON
▸ toJSON(): any
Returns
any
Overrides
Date.toJSON