Constructor.
the desired locale
forLocale() for a caching factory method
Private
#localePrivate
#monthPrivate
#valuesPrivate
#weekdayGet the locale.
Private
#computePrivate
#computePrivate
#hhmmPrivate
#parseParse a day-of-month value in string number form.
the value to parse as a day-of-month number
the unbounded value to use
the field value, or undefined
if not parsable
Private
#parseParse a minute-of-day value in HH:MM
or HH
form.
the value to parse as a minute-of-day number
the unbounded value to use
the field value, or undefined
if not parsable
Private
#parseParse a year value in string number form.
the value to parse as a year number
the unbounded value to use
the field value, or undefined
if not parsable
Format a field value into a locale-specific string.
the field to format
the field value to format
Optional
options: IntRangeFormatOptionsthe options
the formatted field value
Format a field range into a locale-specific string.
the field to format
the range to format
Optional
options: IntRangeFormatOptionsoptions
the formatted range
Parse a field value.
the field to treat val
as
the field value to parse
Optional
options: IntRangeFormatOptionsthe associated field value, or undefined if not found
Parse a chronological field range string.
A "range string" is a string formatted like VALUE - VALUE
. Whitespace
is ignored, and the - VALUE
portion can be omitted for a singleton
range. For example, in the en-US
locale, Jan-Dec
would be parsed as
[1..12]
.
the field to parse the range values as
the range string to parse
Optional
options: IntRangeFormatOptionsthe options
the parsed range, or undefined
if not parsable as a range
If value
is *
then a range of "all possible values" is returned,
in other words the bounding range for that field. If a field has
no implicit bounds (such as YEAR
) then an unbounded range is returned.
Here are some basic examples:
const p = ChronoFieldFormatter.forLocale("en-US");
p.parseRange(ChronoField.MONTH_OF_YEAR, "Jan-Dec"); // [1..12]
p.parseRange(ChronoField.MONTH_OF_YEAR, "4-6"); // [4..6]
p.parseRange(ChronoField.DAY_OF_MONTH, "1-31"); // [1..31]
p.parseRange(ChronoField.DAY_OF_WEEK, "Wednesday"); // [3..3]
p.parseRange(ChronoField.MINUTE_OF_DAY, "00:00-08:30"); // [0..510]
splitRange() for more details on range delimiter handling
Static
forGet a parser for a given locale.
This method will instantiate and cache parsers, returning cached instances if already avaialble.
the locale of the parser to get
the parser
Generated using TypeDoc
Class to parse locale-specific chronological field names of the Gregorian calendar.