Expand description
Date.prototype.toLocaleString / toLocaleDateString / toLocaleTimeString
with their options argument, in the en-US shape.
Node formats these through ICU: ECMA-402’s CreateDateTimeFormat turns the
options bag into a SKELETON ("yMMMMEEEEd", "hm", …), and ICU’s
DateTimePatternGenerator turns the skeleton into a PATTERN
("EEEE, MMMM d, y") by a distance search over the locale’s
availableFormats, adjusting field widths, appending fields no pattern
carries and gluing a date half to a time half. That is what this module is: a
port of dtptngen.cpp’s getBestPattern / getBestRaw /
getBestAppending / adjustFieldTypes over the en data ICU 77 ships, so
every option combination resolves to the pattern node’s does — including the
odd ones, like {day: '2-digit', hour: '2-digit', second: 'numeric'} printing
09, 9 (hour: 13).
The locales argument is still ignored: every locale formats as en-US, as
numfmt does for numbers (see BUGS.md).
Structs§
- Format
- A resolved format: the ICU pattern and the zone it renders in.
Enums§
- Required
- Which
toLocale*Stringis asking: what it requires and defaults to (ECMA-402ToDateTimeOptions).
Functions§
- date_
to_ locale Date.prototype.toLocale{,Date,Time}String(locales, options).- resolve
CreateDateTimeFormatfor thetoLocale*Stringfamily: read and validate the options bag in the order V8 does, applyToDateTimeOptions, and resolve the pattern.