Skip to main content

Module date

Module date 

Source
Expand description

JavaScript Date (global constructor). A Date is a plain object tagged @@native = "Date" whose time value (milliseconds since the Unix epoch, or NaN for an invalid date) lives in a hidden @@ms field.

The UTC-based surface is implemented in full: getTime/valueOf, the toISOString/toUTCString/toString/toDateString/toTimeString/ toLocale* renderings, the field getters, the component SETTERS, the Annex-B getYear/setYear, and the statics Date.now/Date.parse/Date.UTC. Local-timezone getters and setters alias the UTC ones (node-js runs as if TZ=UTC), which is the correct answer for the machine-readable date headers express/send/fresh produce.

Constants§

INSTANCE_METHODS
Every method instance_call below answers. valueOf and toString are on this list because Object.prototype has methods by those names too: without the entry, host::call_method hands a Date to object_builtin_method and date.valueOf() returns the Date itself instead of its time value (so +d and d - 0 were NaN).
STATIC_METHODS

Functions§

construct
new Date(...).
instance_call
Date instance methods (all treated as UTC — see the module note).
static_call
Date.now() / Date.parse(str) / Date.UTC(...).