This modules defines dojo/date/locale, localization methods for Date.
See the dojo/date/locale reference documentation for more information.
addCustomFormats
(packageName,bundleName)
Defined by dojo/date/locale
Add a reference to a bundle containing localized custom formats to be used by date/time formatting and parsing routines.
The user may add custom localized formats where the bundle has properties following the same naming convention used by dojo.cldr: dateFormat-xxxx
/ timeFormat-xxxx
The pattern string should match the format used by the CLDR. See dojo/date/locale.format() for details. The resources must be loaded by dojo.requireLocalization() prior to use
Parameter | Type | Description |
---|---|---|
packageName | String | |
bundleName | String |
format
(dateObject,options)
Defined by dojo/date/locale
Format a Date object as a String, using locale-specific settings.
Create a string from a Date object using a known localized pattern. By default, this method formats both date and time from dateObject. Formatting patterns are chosen appropriate to the locale. Different formatting lengths may be chosen, with "full" used by default. Custom patterns may be used or registered with translations using the dojo/date/locale.addCustomFormats() method. Formatting patterns are implemented using the syntax described at unicode.org
Parameter | Type | Description |
---|---|---|
dateObject | Date |
the date and/or time to be formatted. If a time only is formatted, the values in the year, month, and day fields are irrelevant. The opposite is true when formatting only dates. |
options | Object | Optional
An object with the following properties:
|
Returns: undefined
getNames
(item,type,context,locale)
Defined by dojo/date/locale
Used to get localized strings from dojo.cldr for day or month names.
Parameter | Type | Description |
---|---|---|
item | String |
'months' || 'days' |
type | String |
'wide' || 'abbr' || 'narrow' (e.g. "Monday", "Mon", or "M" respectively, in English) |
context | String | Optional
'standAlone' || 'format' (default) |
locale | String | Optional
override locale used to find the names |
Returns: undefined
isWeekend
(dateObject,locale)
Defined by dojo/date/locale
Determines if the date falls on a weekend, according to local custom.
Parameter | Type | Description |
---|---|---|
dateObject | Date | Optional |
locale | String | Optional |
Returns: boolean
parse
(value,options)
Defined by dojo/date/locale
Convert a properly formatted string to a primitive Date object, using locale-specific settings.
Create a Date object from a string using a known localized pattern. By default, this method parses looking for both date and time in the string. Formatting patterns are chosen appropriate to the locale. Different formatting lengths may be chosen, with "full" used by default. Custom patterns may be used or registered with translations using the dojo/date/locale.addCustomFormats() method.
Formatting patterns are implemented using the syntax described at unicode.org When two digit years are used, a century is chosen according to a sliding window of 80 years before and 20 years after present year, for both yy
and yyyy
patterns. year < 100CE requires strict mode.
Parameter | Type | Description |
---|---|---|
value | String |
A string representation of a date |
options | Object | Optional
An object with the following properties:
|
Returns: null | undefined
regexp
(options)
Defined by dojo/date/locale
Builds the regular needed to parse a localized date
Parameter | Type | Description |
---|---|---|
options | Object | Optional
An object with the following properties:
|
Returns: undefined
© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3-Clause licenses.
http://dojotoolkit.org/api/1.10/dojo/date/locale.html