Incorrect Middle-Eastern Timezones
I am currently using your script and have noticed some discrepancies when I have my timezone set to certain middle eastern locations. The discrepancy is between unix and windows operating systems. For Example: When I have my timezone set to 'Asia/Jerusalem' I start running through AMBIGUITIES array for 'Asia/Beirut'. While in Unix the first 4 values in this array return a getTimezoneOffset() value of 240 - which is equal to the January offset that this value is compared to - and therefore moves on to the next item in the array. Finally, ( still in unix ) we test the 5th value in the array, 'Asia/Jerusalem', and its getTimezoneOffset() comes back with 300, different than January offsets 240 value - so it is decided that is the correct location, and ultimately returns the location as "ISRAEL". This is working perfectly, and is exactly what we had hoped to find at my company.
However, in Windows, the first value in the 'Asia/Beirut' slot of the AMBIGUITIES array (which is Asia/Beirut) comes back with a getTimezoneOffset() value of 300, which causes the script to believe this is the correct location, and ultimately determines our location as being "PAKISTAN".
To remedy this - have changed the New Date() values for the first 4 locations in the array discussed above by incrementing the month by 1.
Have you found this issue before ? Do you believe my solution is valid ?
I will attach my modified script.
Please email me at email@example.com