[Webkit-unassigned] [Bug 14176] Some date values not handled consistently with IE/Firefox

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 22 15:58:24 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=14176





--- Comment #2 from Max Vujovic <mvujovic at adobe.com>  2011-11-22 15:58:24 PST ---
Created an attachment (id=116287)
 --> (https://bugs.webkit.org/attachment.cgi?id=116287&action=review)
Patch

I couldn't reproduce Arno's original bug in r100958. The code snippet outputs "Mon Nov 06 2006 17:53:01 GMT-0800 (PST)" instead of "Invalid Date" for me.

However, I did reproduce David's bug in the second comment. WebKit interprets "GMT-4" as 4 minutes. On the other hand, IE, Firefox, and Opera interpret "GMT-4" as 4 hours. This case is defined as implementation specific in the ECMA Standard (See Section 15.9.4.2), but I think WebKit should match IE, FireFox, and Opera's behavior. 

WebKit's implementation reads in the number after "GMT-" and mods by 100 for the minute offset and divides by 100 for the hour offset for all numbers. On the other hand, IE, FireFox, and Opera only do this if the number is greater than or equal to 24. If the number is less than 24, they interpret it as an hour offset with no minutes.

Interestingly, even "GMT-0004" is interpreted as four hours in IE, FireFox, and Opera.

I used this test script to compare the behaviors:

<script language="javascript" type="text/javascript">
     document.write('"4/13/2008 12:00 AM GMT-4" parsed: ' + new Date('4/13/2008 12:00 AM GMT-4') + '<br/>');
     document.write('"4/13/2008 12:00 AM GMT-23" parsed: ' + new Date('4/13/2008 12:00 AM GMT-23') + '<br/>');
     document.write('"4/13/2008 12:00 AM GMT-023" parsed: ' + new Date('4/13/2008 12:00 AM GMT-023') + '<br/>');
     document.write('"4/13/2008 12:00 AM GMT-0023" parsed: ' + new Date('4/13/2008 12:00 AM GMT-0023') + '<br/>');
     document.write('"4/13/2008 12:00 AM GMT-24" parsed: ' + new Date('4/13/2008 12:00 AM GMT-24') + '<br/>');
     document.write('"4/13/2008 12:00 AM GMT-024" parsed: ' + new Date('4/13/2008 12:00 AM GMT-024') + '<br/>');
     document.write('"4/13/2008 12:00 AM GMT-0024" parsed: ' + new Date('4/13/2008 12:00 AM GMT-0024') + '<br/>');
     document.write('"4/13/2008 12:00 AM GMT-0123" parsed: ' + new Date('4/13/2008 12:00 AM GMT-0123') + '<br/>');              
</script>

The results were:

GMT-4 = 4 hours in IE, FireFox, and Opera vs. 4 minutes in WebKit

GMT-23 = 23 hours in IE, FireFox, and Opera vs. 23 minutes in WebKit
GMT-023 = same as above
GMT-0023 = same as above

GMT-24 = 24 minutes in all implementations (IE, FireFox, Opera, and WebKit)
GMT-024= same as above
GMT-0024 = same as above

GMT-0123 = 1 hour, 23 minutes in all implementations (IE, FireFox, Opera, and WebKit)

I've uploaded a patch that makes WebKit match the IE, FireFox, and Opera behavior.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list