A locale object. Default locale is `en-US`.
A locale object. Default locale is en-US
.
If you're using any of these date-fns, consider specifying a locale in options:
differenceInCalendarWeeks
eachWeekOfInterval
endOfWeek
format
formatDistance
formatDistanceStrict
formatRelative
getWeek
getWeekOfMonth
getWeeksInMonth
getWeekYear
isMatch
isSameWeek
isThisWeek
lastDayOfWeek
parse
setDay
setWeek
setWeekYear
startOfWeek
startOfWeekYear
Read the Properties section below for more details.
Name | Type | Description |
---|---|---|
code |
string |
the locale code (ISO 639-1 + optional country code) |
formatDistance |
function |
the function that takes a token
passed by |
formatRelative |
function |
the function that takes a token
passed by |
localize |
Object |
the object with functions used to localize various values.
Required by |
localize.ordinalNumber |
function |
the function that localizes an ordinal number |
localize.era |
function |
the function that takes 0 or 1 and returns localized era |
localize.quarter |
function |
the function that localizes a quarter |
localize.month |
function |
the function that localizes a month |
localize.day |
function |
the function that localizes a day of the week |
localize.dayPeriod |
function |
the function that takes one of the strings 'am', 'pm', 'midnight', 'noon', 'morning', 'afternoon', 'evening' or 'night' and returns localized time of the day |
formatLong |
Object |
the object with functions that return localized formats |
formatLong.date |
function |
the function that returns a localized long date format |
formatLong.time |
function |
the function that returns a localized long time format |
formatLong.dateTime |
function |
the function that returns a localized format of date and time combined |
match |
Object |
— the object with functions used to match and parse various localized values.
Required by |
match.ordinalNumber |
function |
the function that parses a localized ordinal number |
match.era |
function |
the function that parses a localized era |
match.quarter |
function |
the function that parses a localized quarter |
match.month |
function |
the function that parses a localized month |
match.day |
function |
the function that parses a localized day of the week |
match.dayPeriod |
function |
the function that parses a localized time of the day |
options |
Object |
an object with locale options. |
options.weekStartsOn |
0 1 2 3 4 5 6 |
the index of the first day of the week (0 - Sunday).
Used by |
options.firstWeekContainsDate |
1 2 3 4 5 6 7 |
the day of January,
which is always in the first week of the year.
Used by |
Type | Description |
---|---|
RangeError |
|
RangeError |
|
RangeError |
|
RangeError |
|
RangeError |
|
© 2021 Sasha Koss and Lesha Koss
Licensed under the MIT License.
https://date-fns.org/v2.29.2/docs/Locale