1. Jon Nylander
  2. jsTimezoneDetect
  3. Issues


Issue #3 resolved


Anonymous created an issue

I made more investigations and picked up all Olson timezones and their standard and dst offsets and if dst is observed, also the start time of dst and in dst-cases also hemisphere. The source was timezone-functions of php 5.3.5 and it's newest timezonedb version 2010.15. All dst observable timezones had dst start in 2011, excluding Fiji and Apia and it seems that they are not going to make dst-transition in 2011, so I take in these cases the dst start time of 2010 (september and october).

To find the most relevant or important timezone in cases when timezones were "unique", meaning all aspects (std offset, dst offset, dst start time) were the same, I made one more database search: the population of timezone. The source was database of 99 534 cities in [[http://download.geonames.org/export/dump/cities1000.zip|http://download.geonames.org/export/dump/cities1000.zip]] (all cities with population more than 1000). One of the columns in this database is the timezone of city. I think the population of timezone shall be the criteria to select the timezone. In detection script there are some timezones that could be replaced with more-populated ones, for example the following:

91038197 America/New_York

7983504 America/Montreal

60508715 Europe/London

2768284 Europe/Dublin

81562426 Europe/Berlin

14898174 Europe/Amsterdam

56458136 Europe/Istanbul

5208603 Europe/Helsinki

(See more on my home page, following the link below.)

These "unique" timezones are missing: Pacific/Marquesas, Pacific/Gambier, Pacific/Pitcairn, America/Santa_Isabel, Pacific/Easter, America/Havana, America/Goose_Bay,
America/Sao_Paulo, Asia/Gaza, Australia/Lord_Howe, Pacific/Norfolk, Pacific/Kiritimati

The result of my research is in this address: [[http://www.kahkonen.com/loc/timezones_by_population2.php|http://www.kahkonen.com/loc/timezones_by_population2.php]]

Comments (8)

  1. Anonymous

    According to $ zdump -v Asia/Gaza:


    Asia/Gaza Fri Mar 25 22:00:59 2011 UTC = Sat Mar 26 00:00:59 2011 EET isdst=0 gmtoff=7200

    Asia/Gaza Fri Mar 25 22:01:00 2011 UTC = Sat Mar 26 01:01:00 2011 EEST isdst=1 gmtoff=10800

    Asia/Gaza Thu Sep 1 22:59:59 2011 UTC = Fri Sep 2 01:59:59 2011 EEST isdst=1 gmtoff=10800

    Asia/Gaza Thu Sep 1 23:00:00 2011 UTC = Fri Sep 2 01:00:00 2011 EET isdst=0 gmtoff=7200


    Dst start seems to be Fri Mar 25 22:01:00 2011 UTC. This is unusual time, usually start times are full hours, but maybe it is right.

  2. Jon Nylander repo owner

    Nice work. I've used your list as a resource and added most of the "missing" timezones you mentioned. Many of them are not even possible to set as timezone in OSX as far as I can tell. But they may be in the future.

    Gaza was a really nice find!

  3. Anonymous

    Linux is an other story. Timezone can be set by linking to olson tzfile:

    $ ln -sf /usr/share/zoneinfo/Asia/Gaza /etc/localtime


  4. Jon Nylander repo owner

    Yeah I noticed the same was possible on my Mac so now I've been able to test all the timezones. I think I've included all the ones you have found, and changed the IDs to the most populated ones. Feel free to test around!

    One problem was Pacific/Kiritimati which worked in all browsers except in Firefox (in OSX). In Firefox it resolved to Pacific/Honolulu, weird!

    Again, absolutely fantastic help from you!

  5. Anonymous

    I have used the script below for testing in Mac OSX. It waits keypress and then change timezone. And various browsers are set via javascript to refresh itself every second. Opera and Chrome sucks, they have to restart every time when timezone change occurs. Firefox and Opera performed well. Although Pacific/Kiritimati fails in Firefox. Maybe Firefox thinks that when the offset is more or less than 12 then it's same which is the direction (minus or plus) of transition.

    readOne () {
    tput smso
    echo "Press any key to return \c"
    tput rmso
    oldstty=`stty -g`
    stty -icanon -echo min 1 time 0
    dd bs=1 count=1 >/dev/null 2>&1
    stty "$oldstty"
    names=( Africa/Cairo America/Asuncion America/Campo_Grande etc. etc.)
    for name in ${names[@]}
    systemsetup settimezone $name
  6. Anonymous

    I added more functionality to above shell script because not all browsers are able to take into account if the user changes the system timezone when the browser is open. Firefox performs this task well and Safari almost always but Opera and Chrome will go unstable and mydate.getTimezoneOffset() gives 0 or some other incorrect value so detection fails and these browsers has to be restarted to get detection succeed again.

    The idea of this script is to easily and nearly automatically test how javascript based timezone detection tool can detect the timezone of user's system.

    What you need?

    • Detection script .js and .html files ( https:bitbucket.org/pellepim/jstimezonedetect/src)
    • Those files also in local path (to test in Safari, others accept url; maybe safari also accept urls but I don't know proper command line switch)
    • Add this javascript code to index.html inside <head></head> tags to refresh page automatically every second:
    <script type="text/javascript">
    function reFresh() {
    • The code below in local path saved as test.sh file (remember to change paths to Opera, Chrome and Safari and paths to index.html)
    • Compatible OS (Tested in Mac OS X, but may work with little modifications also in other OS)
    • Open index.html in Firefox (which is not included in shell script because Firefox check the system timezone always when page is reloaded)
    • When these done, execute in terminal: $ sh test.sh
    • Then press any key to change system timezone and follow results in browser windows.
    readOne () {
    tput smso
    echo "Press any key to change system timezone \c"
    tput rmso
    oldstty=`stty -g`
    stty -icanon -echo min 1 time 0
    dd bs=1 count=1 >/dev/null 2>&1
    stty "$oldstty"
    names=(Pacific/Pago_Pago Pacific/Honolulu America/Adak Pacific/Apia Pacific/Marquesas Pacific/Gambier America/Anchorage Pacific/Pitcairn America/Los_Angeles America/Santa_Isabel America/Phoenix America/Denver America/Mazatlan America/Guatemala America/Chicago America/Mexico_City America/Bogota Pacific/Easter America/Havana America/New_York America/Caracas America/Santo_Domingo America/Goose_Bay America/Halifax America/St_Johns America/Argentina/Buenos_Aires America/Campo_Grande America/Santiago America/Miquelon America/Godthab America/Asuncion Atlantic/Stanley America/Noronha America/Sao_Paulo America/Montevideo Atlantic/Cape_Verde Atlantic/Azores Africa/Casablanca Europe/London Africa/Lagos Europe/Berlin Asia/Gaza Asia/Beirut Europe/Minsk Europe/Istanbul Asia/Damascus Asia/Jerusalem Africa/Windhoek Africa/Cairo Africa/Johannesburg Asia/Baghdad Europe/Moscow Asia/Tehran Asia/Dubai Asia/Yerevan Asia/Baku Asia/Kabul Asia/Karachi Asia/Yekaterinburg Asia/Kolkata Asia/Kathmandu Asia/Dhaka Asia/Omsk Asia/Rangoon Asia/Jakarta Asia/Krasnoyarsk Asia/Shanghai Asia/Irkutsk Australia/Eucla Asia/Tokyo Asia/Yakutsk Australia/Darwin Australia/Brisbane Asia/Vladivostok Australia/Adelaide Pacific/Noumea Asia/Kamchatka Australia/Lord_Howe Australia/Sydney Pacific/Norfolk Pacific/Tarawa Pacific/Tongatapu Pacific/Fiji Pacific/Auckland Pacific/Chatham Pacific/Kiritimati)
    for name in ${names[@]}
    `killall -9 Google\ Chrome &>/dev/null &`
    `killall Opera &>/dev/null &`
    `killall Safari &>/dev/null &`
    systemsetup settimezone $name
    `/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome -app=http://www.example.com/index.html &>/dev/null &`
    `/Applications/Opera.app/Contents/MacOS/Opera http://www.example.com/index.html &>/dev/null &`
    `/Applications/Safari.app/Contents/MacOS/Safari /Users/timo/Documents/scripts/index.html &>/dev/null &`

    Happy testing!


  7. Anonymous

    Firefox also doesn't always reload information of timezone on page reload so it should also be added to the shell script:

    `killall -9 firefox-bin`
    `/Applications/Firefox.app/Contents/MacOS/firefox http://www.example.com/index.html &>/dev/null &`

    Note! Please use shell script at your own risk. killall command terminates browser processes.

    Before running shell script get your timezone using this:

    $ systemsetup gettimezone

    After using script set your own timezone back:

    $ systemsetup settimezone Your_Timezone

    (All these are Mac OS X commands and may or may not work in other OS)


  8. Log in to comment