Skip to content
A jQuery plugin for detect_timezone.js
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

jQuery Detect TimeZone Plugin

This jQuery plugin leverages Jon Nylander's jstimezonedetect (based on work by Josh Fraser).


There are plenty of javascript examples out there showing how to work with the timezone offset. Unfortunately this approach has some disadvantages, especially in regards to day light savings.

Determining timezones using javascript is not trivial out of the box. Different browsers use different acronyms and conventions for representing names of timezones, it also differs depending on the user's operating system.

How to use

First, add the required scripts to your page (jquery, detect_timezone.js, and jquery.detect_timezone.js)

Then use one of the two timezone functions.

  1. set_timezone - sets the current timezone value by calling .val on the selector. This generally assumes the selector is an input (text or hidden).
  2. get_timezone - this method will return the current Olson timezone name.


  • debug - defaults to false. When true, it let you know that for some reason a timezone could not be found.
  • default - allows you to set a default value in the case no timezone could be found. Defaults to 'America/New_York'


				'default' : 'America/Los_Angeles'

Note: There is an extremely minimal example in this repository.


Blah, blah, blah....use it, tweak it, etc.

Always feel free to drop me a line at scottwater@gmail, but please use GitHub issues for any bugs/etc.

You can’t perform that action at this time.