Login Register Help
API Documentation
Choose a stylesheet:

Functiondojo.date.locale.parse (returns null | Date)

dojo.require("dojo.date.locale");

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.

defined in dojo/date/locale.js
parametertypedescription
valueStringA string representation of a date
optionsdojo.date.locale.__FormatOptionsOptional.
fieldtypedescription
amStringoverride strings for am in times
datePatternStringoverride pattern with this string
formatLengthStringchoice of long, short, medium or full (plus any custom additions). Defaults to 'short'
fullYearBoolean(format only) use 4 digit years whenever 2 digit years are called for
localeStringoverride the locale used to determine formatting rules
pmStringoverride strings for pm in times
selectorStringchoice of 'time','date' (default: date and time)
strictBoolean(parse only) strict parsing, off by default
timePatternStringoverride pattern with this string

Usage

var foo: null|Date=dojo.date.locale.parse(value: String, options: dojo.date.locale.__FormatOptions?);