search

goog.i18n.RelativeDateTimeFormat

Module ID

RelativeDateTimeFormat provides methods to format simple relative dates and times into a string in a user friendly way and a locale sensitive manner. Numeric quantities are supported with negative values indicating the past, zero meaning now, and positive for the future. Specific named times such as "tomorrow" are returned and correctly pluralized results are given for relative times without specific names such as "in 5 days" or "3 weeks ago". The result is localized according to current locale value.

Similar to the ICU4J class com/ibm/icu/text/RelativeDateTimeFormatter: http://icu-project.org/apiref/icu4j/com/ibm/icu/text/RelativeDateTimeFormatter.html

new RelativeDateTimeFormat( opt_numeric, opt_style, opt_relativeDateTimeSymbols )

Parameters
opt_numericmodule$exports$goog$i18n$RelativeDateTimeFormat.NumericOption=

This optional string determines if formatted output is always the numeric formatting rather than available relative strings. ALWAYS (default) forces numeric results in all uses of this instance. AUTO mode uses available relative strings such as "tomorrow", falling back to numeric.

opt_stylemodule$exports$goog$i18n$RelativeDateTimeFormat.Style=

This optional value determines the style of the relative time output. Values include LONG, SHORT, NARROW. Default is LONG. as part of the resulting formatted string

opt_relativeDateTimeSymbols{DAY: {LONG: {F: string, P: string, R: Object<string, string>}, NARROW: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined), SHORT: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined)}, HOUR: {LONG: {F: string, P: string, R: Object<string, string>}, NARROW: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined), SHORT: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined)}, MINUTE: {LONG: {F: string, P: string, R: Object<string, string>}, NARROW: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined), SHORT: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined)}, MONTH: {LONG: {F: string, P: string, R: Object<string, string>}, NARROW: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined), SHORT: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined)}, QUARTER: {LONG: {F: string, P: string, R: Object<string, string>}, NARROW: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined), SHORT: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined)}, SECOND: {LONG: {F: string, P: string, R: Object<string, string>}, NARROW: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined), SHORT: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined)}, WEEK: {LONG: {F: string, P: string, R: Object<string, string>}, NARROW: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined), SHORT: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined)}, YEAR: {LONG: {F: string, P: string, R: Object<string, string>}, NARROW: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined), SHORT: (module$contents$goog$i18n$relativeDateTimeSymbols_StyleElement|null|undefined)}}=

This optional value can be used to set the data for to use for this instance rather than obtaining from relativedatetimesymbols.

Instance Methods

Exported Properties