goog.i18n.DateTimeParse.ParseOptions
Provided By |
---|
Options object for calls to DateTimeParse.prototype.parse.
Instance Properties
this.predictive → (boolean|undefined)
(boolean|undefined)
Whether to use predictive parsing. Predictive parsing generates successful parse results for non-empty partial inputs that have valid completions for the parse pattern.
If the end of the input is reached while parsing, numeric patterns parts such as "HH" will infer values by padding with trailing 0s, and string pattern parts such as "a" will attempt to prefix match valid values. E.g. for the pattern "HH:mm" the input "12:3" will parse to a value equivalent to "12:30" and for the pattern "h:mm a" the input "12:34 p" will parse to a value equivalent to "12:30 PM".
Predictive parsing currently only supports the pattern symbols "ahHkKm" and is not compatible with abutting number patterns. Attempting to parse using the predictive option with unsupported patterns will result in an error being thrown.
Defaults to false.
this.validate → (boolean|undefined)
(boolean|undefined)
Whether the parsed date/time value should be validated.
When true, parsing will fail if any of the parsed fields overflow, e.g. minutes > 60.
Note that setting validate
to false
does not mean that parsing will
not fail: if the parser encounters an unknown month or day-of-week name
(for instance) then parsing will still fail. This only checks for overflow.
Defaults to false.