Created
August 9, 2012 18:11
-
-
Save kimsterv/3306652 to your computer and use it in GitHub Desktop.
looking for user's timezone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cookie_tz = $.cookie('tz'); | |
if (user_tz == null) { | |
if (cookie_tz == null) { | |
try { | |
var tmp_tz = jstz.determine_timezone(); | |
if (tmp_tz) { | |
user_tz = tmp_tz.name(); | |
$.cookie('tz', user_tz); | |
} | |
} catch(err) { | |
console.log('failed to determine timezone'); | |
} | |
} else { | |
user_tz = cookie_tz; | |
} | |
} else { | |
if (cookie_tz == null) { | |
$.cookie('tz', user_tz); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment