Skip to content
dsimard edited this page Oct 19, 2010 · 3 revisions

jsKata.timezone

Returns standard and daylight saving time zones based on the user's browser

Read more at http://www.javascriptkata.com/2010/10/14/auto-detect-timezones-time-zone-offsets-and-daylight-saving-in-javascript/

Functions

hasDst() : boolean

Returns if the timezone has daylight saving time.

st() : integer

Returns the standard time offset of the timezone in seconds. Example, North America/Eastern Time returns -300.

stToString(timeSeparator) : integer

Returns the standard time offset of the timezone in hour. Example, North America/Eastern Time returns -0500.

timeSeparator string : Time separator (":" would return -05:00)

dst() : integer

Returns the daylight saving time offset of the timezone in seconds. Example, North America/Eastern Time returns -240.

timeSeparator string : Time separator (":" would return -05:00)

dstToString(timeSeparator) : integer

Returns the daylight saving time offset of the timezone in hour. Example, North America/Eastern Time returns -0400.