new Date().toUTCString() returns wrong timezone

RESOLVED DUPLICATE of bug 224744

Status

()

Core
JavaScript Engine
RESOLVED DUPLICATE of bug 224744
13 years ago
4 years ago

People

(Reporter: Gene Dallosto, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

 { document.write( janx.toUTCString() +  "<br>");

returns                       2006 Sun, 01 Jan 2006 00:00:00 GMT
the correct output should be  2006 Sun, 01 Jan 2006 00:00:00 UTC  

Reproducible: Always

Steps to Reproduce:
1.  go to URL
2.  This URL retruns the correct string with Netscape 8.0 and IE
3.



Expected Results:  
janx.toUTCString()  should return the string that contais "UTC" not "GMT"

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) 
Gecko/20051111 Firefox/1.5
I think this is valid. See bug 58673

Comment 2

13 years ago
bug 58673 (the spec actually) says Date.prototype.toUTCString and Date.prototype.toGMTString should be the same thing.

Regarding toUTCString ECMA spec says:
"15.9.5.42 Date.prototype.toUTCString ( )
This function returns a string value. The contents of the string are implementation-dependent, but are
intended to represent the Date in a convenient, human-readable form in UTC."

Not sure if it implies the string should contain "UTC".
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Summary: { document.write( janx.toUTCString() + "<br>"); returns wrong string → new Date().toUTCString() returns wrong string (has "UTC" instead of "GMT")
Version: unspecified → Trunk
The spec implies nothing one way or the other about GMT or UTC at the end.  This bug is asking us to imitate IE's implementation.  As Steve pointed out in comment 1 (his "this" referred to SpiderMonkey's behavior, not to this bug), elsewhere in the spec (B.2.6) the toGMTString method is defined as the same function object as the toUTCString.

Unless that native function senses by which name it was called, and changes its behavior, the only way to fix this bug without violating that appendix to the spec is to change toGMTString to use "UTC" at the end, instead of "GMT".  Would that match IE or any other browser?

Wasting time chasing IE deviations from the spec is generally considered harmful unless much of the web comes to count on the deviation.  In JS compared to HTML and DOM quirks, the deviation is not so often widely used.  Bob, any data?

/be
Firefox/Opera/Safari all use GMT on toGMTString and toUTCString. MSIE uses UTC on both. See also bug 224744. UTC is probably "more" correct however this has existed since the beginning of time, and I don't see the benefit of changing our behavior now. 
Summary: new Date().toUTCString() returns wrong string (has "UTC" instead of "GMT") → new Date().toUTCString() returns wrong timezone
Whiteboard: DUPEME

*** This bug has been marked as a duplicate of 224744 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → DUPLICATE

Updated

4 years ago
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.