The goog.i18n.TimeZone Class

goog.i18n.TimeZone()

TimeZone class implemented a time zone resolution and name information source for client applications. The time zone object is initiated from a time zone information object. Application can initiate a time zone statically, or it may choose to initiate from a data obtained from server. Each time zone information array is small, but the whole set of data is too much for client application to download. If end user is allowed to change time zone setting, dynamic retrieval should be the method to use. In case only time zone offset is known, there is a decent fallback that only use the time zone offset to create a TimeZone object. A whole set of time zone information array was available under http://go/js_locale_data. It is generated based on CLDR and Olson time zone data base (through pytz), and will be updated timely.

The goog.i18n.TimeZone.NameType Enum

Indices into the array of time zone names. … more

.createTimeZone(timeZoneData)

This factory method creates a time zone instance. It takes either an object containing complete time zone information, or a single number representing a constant time zone offset. If the latter form is used, DST functionality is not available.

timeZoneData {number|Object}
If this parameter is a number, it should indicate minutes WEST of UTC to be used as a constant time zone offset. Otherwise, it should be an object with these four fields:
returns {goog.i18n.TimeZone}
A goog.i18n.TimeZone object for the given time zone data.

.getDaylightAdjustment(date)

Return the DST adjustment to the time zone offset for a given time. While Daylight Saving Time is in effect, this number is positive. Otherwise, it is zero.

date {goog.date.DateLike}
The time to check.
returns {number}
The DST adjustment in minutes EAST of UTC.

.getGMTString(date)

Return the GMT representation of this time zone object.

date {goog.date.DateLike}
The date for which time to retrieve GMT string.
returns {string}
GMT representation string.

.getLongName(date)

Get the long time zone name for a given date/time.

date {goog.date.DateLike}
The time for which to retrieve the long time zone name.
returns {string}
The long time zone name.

.getOffset(date)

Get the time zone offset in minutes WEST of UTC for a given date/time.

date {goog.date.DateLike}
The time for which to retrieve the time zone offset.
returns {number}
The time zone offset in minutes WEST of UTC.

.getRFCTimeZoneString(date)

Get the RFC representation of the time zone for a given date/time.

date {goog.date.DateLike}
The time for which to retrieve the RFC time zone string.
returns {string}
The RFC time zone string.

.getShortName(date)

Get the short time zone name for given date/time.

date {goog.date.DateLike}
The time for which to retrieve the short time zone name.
returns {string}
The short time zone name.

.getTimeZoneData()

Convert the contents of time zone object to a timeZoneData object, suitable for passing to goog.i18n.TimeZone.createTimeZone.

returns {Object}
A timeZoneData object (see the documentation for goog.i18n.TimeZone.createTimeZone).

.getTimeZoneId()

Return the time zone ID for this time zone.

returns {string}
The time zone ID.

.isDaylightTime(date)

Check if Daylight Saving Time is in effect at a given time in this time zone.

date {goog.date.DateLike}
The time to check.
returns {boolean}
True if Daylight Saving Time is in effect.