Closed Bug 347196 Opened 18 years ago Closed 18 years ago

javascript:alert((new Date()).getTimezoneOffset()) returns incorrect value

Categories

(Core :: JavaScript Engine, defect)

1.7 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 285615

People

(Reporter: surinderk1962, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6

I faced same problem and did some more work on this. This is very well replicable problem. My findings are as under:

The value returned by javascript:alert((new Date()).getTimezoneOffset()) in Firefox depends upon the time zone settings at the time of installation of Firefox on the PC. For example, suppose the time zone on a PC is IST (+05:30 of GMT) at the time of installation of Firefox. The value returned is -330 which is correct. Now, suppose the time zone is changed to Brisbane (+10:00 of GMT). The value returned by Firefox is still -330, whereas IE returns a value of -600 (which is correct). Now, if we re-install the Firefox, this also returns a value of -600.

My findings are that Firefox some how locks the Time Zone at the time of installation, and picks up the value from this locked place, rather then picking up from the system's time zone. I hope that these findings will be helpful in providing patch. Please feel free to contact me at surinderk1962@gmail.com for any further clarification / discussion. 



Reproducible: Always

Steps to Reproduce:
1. Set a Time Zone on the PC
2. Install Fire Fox.
3. Note the value as returned by javascript:alert((new Date()).getTimezoneOffset())
4. Change the time zone to some other zone.
5. Note the value as returned by javascript:alert((new Date()).getTimezoneOffset()). This will be same as returned in step 3 above. This is incorrect, as the time zone has been changed.
6. Re-install Firefox
7. Now, note the value as returned by javascript:alert((new Date()).getTimezoneOffset()). This will NOT be same as returned in step 3 and 5 above. Now, this will be as per the new time zone as chosen in step 4 above.
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.7 Branch
Actually just restarting the browser will pick up the new timezone.

*** This bug has been marked as a duplicate of 285615 ***
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
(In reply to comment #1)
> Actually just restarting the browser will pick up the new timezone.
> 
> *** This bug has been marked as a duplicate of 285615 ***
> 

Hi,

I have even tried rebooting the PC after chaging the time zone, but with no success.
You need to log in before you can comment on or make changes to this bug.