i18n.DateTimeParse Extends
Construct a DateTimeParse based on current locale.

Inheritance

Constructor

goog.i18n.DateTimeParse(pattern)

Parameters

pattern : string | number
pattern specification or pattern type.

Instance Methods

Public Protected Private
applyPattern_(pattern)
Apply a pattern to this Parser. The pattern string will be parsed and saved in "compiled" form. Note: this method is somewhat similar to the pattern parsing method in datetimeformat. If you see something wrong here, you might want to check the other.
Arguments:
pattern : string
It describes the format of date string that need to be parsed.
code »
applyStandardPattern_(formatType)
Apply a predefined pattern to this Parser.
Arguments:
formatType : number
A constant used to identified the predefined pattern string stored in locale repository.
code »
getNextCharCount_(patternstart) number
Calculate character repeat count in pattern.
Arguments:
pattern : string
It describes the format of date string that need to be parsed.
start : number
The position of pattern character.
Returns: number  Repeat count.
code »
internalParse_(textdatestartvalidation) number
Parse the given string and fill info into date object.
Arguments:
text : string
The string being parsed.
date : goog.date.DateLike
The Date object to hold the parsed date.
start : number
The position from where parse should begin.
validation : boolean
If true, input string need to be a valid date/time string.
Returns: number  How many characters parser advanced.
code »
isNumericField_(part) boolean
Check if the pattern part is a numeric field.
Arguments:
part : Object
pattern part to be examined.
Returns: boolean  true if the pattern part is numeric field.
code »
markAbutStart_()
Identify the start of an abutting numeric fields' run. Taking pattern "HHmmss" as an example. It will try to parse 2/2/2 characters of the input text, then if that fails, 1/2/2. We only adjust the width of the leftmost field; the others remain fixed. This allows "123456" => 12:34:56, but "12345" => 1:23:45. Likewise, for the pattern "yyyyMMdd" we try 4/2/2, 3/2/2, 2/2/2, and finally 1/2/2. The first field of connected numeric fields will be marked as abutStart, its width can be reduced to accommodate others.
code »
matchString_(textposdata) number
Attempt to match the text at a given position against an array of strings. Since multiple strings in the array may match (for example, if the array contains "a", "ab", and "abc", all will match the input string "abcd") the longest match is returned.
Arguments:
text : string
The string to match to.
pos : Array.<number>
parsing position.
data : Array.<string>
The string array of matching patterns.
Returns: number  the new start position if matching succeeded; a negative number indicating matching failure.
code »
parse(textdateopt_start) number
Parse the given string and fill info into date object. This version does not validate the input.
Arguments:
text : string
The string being parsed.
date : goog.date.DateLike
The Date object to hold the parsed date.
opt_start : number=
The position from where parse should begin.
Returns: number  How many characters parser advanced.
code »
parseInt_(textpos) number
Parse a integer string and return integer value.
Arguments:
text : string
string being parsed.
pos : Array.<number>
parse position.
Returns: number  Converted integer value.
code »
parseTimeZoneOffset_(textposcal) boolean
Parse time zone offset.
Arguments:
text : string
the time text to be parsed.
pos : Array.<number>
Parse position.
cal : goog.i18n.DateTimeParse.MyDate_
object to hold parsed value.
Returns: boolean  True if successful.
code »
skipSpace_(textpos)
Skip space in the string.
Arguments:
text : string
input string.
pos : Array.<number>
where skip start, and return back where the skip stops.
code »
strictParse(textdateopt_start) number
Parse the given string and fill info into date object. This version will validate the input and make sure it is a validate date/time.
Arguments:
text : string
The string being parsed.
date : goog.date.DateLike
The Date object to hold the parsed date.
opt_start : number=
The position from where parse should begin.
Returns: number  How many characters parser advanced.
code »
subParseDayOfWeek_(textposcal) boolean
Parse Day of week field.
Arguments:
text : string
the time text to be parsed.
pos : Array.<number>
Parse position.
cal : goog.i18n.DateTimeParse.MyDate_
object to hold parsed value.
Returns: boolean  True if successful.
code »
subParseFractionalSeconds_(valueposstartcal) boolean
Parse fractional seconds field.
Arguments:
value : number
parsed numeric value.
pos : Array.<number>
current parse position.
start : number
where this field start.
cal : goog.i18n.DateTimeParse.MyDate_
object to hold parsed value.
Returns: boolean  True if successful.
code »
subParseMonth_(textposcalvalue) boolean
Parse Month field.
Arguments:
text : string
the time text to be parsed.
pos : Array.<number>
Parse position.
cal : goog.i18n.DateTimeParse.MyDate_
object to hold parsed value.
value : number
numeric value if this field is expressed using numeric pattern, or -1 if not.
Returns: boolean  True if parsing successful.
code »
subParseQuarter_(textposcalvalue) boolean
Parse Quarter field.
Arguments:
text : string
the time text to be parsed.
pos : Array.<number>
Parse position.
cal : goog.i18n.DateTimeParse.MyDate_
object to hold parsed value.
value : number
numeric value if this field is expressed using numeric pattern, or -1 if not.
Returns: boolean  True if parsing successful.
code »
subParseYear_(textposstartvaluepartcal) boolean
Parse year field. Year field is special because 1) two digit year need to be resolved. 2) we allow year to take a sign. 3) year field participate in abut processing.
Arguments:
text : string
the time text to be parsed.
pos : Array.<number>
Parse position.
start : number
where this field start.
value : number
integer value of year.
part : Object
the pattern part for this field.
cal : goog.i18n.DateTimeParse.MyDate_
object to hold parsed value.
Returns: boolean  True if successful.
code »
subParse_(textpospartdigitCountcal) boolean
Protected method that converts one field of the input string into a numeric field value.
Arguments:
text : string
the time text to be parsed.
pos : Array.<number>
Parse position.
part : Object
the pattern part for this field.
digitCount : number
when > 0, numeric parsing must obey the count.
cal : goog.i18n.DateTimeParse.MyDate_
object that holds parsed value.
Returns: boolean  True if it parses successfully.
code »
subparseTimeZoneInGMT_(textposcal) boolean
Parse GMT type timezone.
Arguments:
text : string
the time text to be parsed.
pos : Array.<number>
Parse position.
cal : goog.i18n.DateTimeParse.MyDate_
object to hold parsed value.
Returns: boolean  True if successful.
code »

Instance Properties

patternParts_ :
No description.
Code »

Static Properties

goog.i18n.DateTimeParse.NUMERIC_FORMAT_CHARS_ :
Pattern characters that specify numerical field.
Code »
goog.i18n.DateTimeParse.PATTERN_CHARS_ :
All acceptable pattern characters.
Code »
goog.i18n.DateTimeParse.ambiguousYearCenturyStart :
Number of years prior to now that the century used to disambiguate two digit years will begin
Code »

Package i18n

Package Reference