Closed
Bug 363578
Opened 18 years ago
Closed 17 years ago
Date.UTC returns incorrect value if date is less than or equal to 0
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: nanto, Assigned: jag+mozilla)
Details
Attachments
(2 files, 1 obsolete file)
2.53 KB,
patch
|
Details | Diff | Splinter Review | |
5.11 KB,
patch
|
mrbkap
:
review+
brendan
:
approval1.9+
|
Details | Diff | Splinter Review |
new Date(Date.UTC(2006, 0, 0)).getUTCDate() returns 1 (2006-01-01), but should return 31 (2005-12-31). Other browsers (IE 7, Opera 9 and Safari 2) returns 31.
js/src/jsdate.c
594 /* if we got a 0 for 'date' (which is out of range)
595 * pretend it's a 1. (So Date.UTC(1972, 5) works) */
596 if (array[2] < 1)
597 array[2] = 1;
Should check argc. ECMA-262 3rd 15.9.4.3 says "3. If date is supplied use ToNumber(date); else use 1."
Assignee | ||
Comment 1•18 years ago
|
||
1) per 15.9.4.3 step 3, default day-of-month to 1 if missing
2) per 15.9.1.12 step 8, simply add the day-of-month value as-is
3) return NaN if any arg is NaN or infinite
4) use js_DoubleToInteger() instead of floor()
Assignee | ||
Comment 2•18 years ago
|
||
See bug 379104 for the Rhino version of this
Assignee | ||
Comment 3•18 years ago
|
||
Assignee | ||
Updated•18 years ago
|
Attachment #263105 -
Flags: review?(mrbkap)
Comment 4•18 years ago
|
||
Comment on attachment 263105 [details] [diff] [review]
Same, but with most of the shared code factored out
Remove that terribly outdated Win16 comment and r=mrbkap.
Attachment #263105 -
Flags: review?(mrbkap) → review+
Assignee | ||
Comment 5•18 years ago
|
||
Comment on attachment 263105 [details] [diff] [review]
Same, but with most of the shared code factored out
Seeking approval for 1.9. Whoever checks this in, don't forget to remove the Win16 comment.
Attachment #263105 -
Flags: approval1.9?
Assignee | ||
Comment 6•18 years ago
|
||
Attachment #263105 -
Attachment is obsolete: true
Attachment #275169 -
Flags: review?(mrbkap)
Attachment #263105 -
Flags: approval1.9?
Updated•18 years ago
|
Attachment #275169 -
Flags: review?(mrbkap) → review+
Assignee | ||
Updated•18 years ago
|
Attachment #275169 -
Flags: approval1.9?
Updated•17 years ago
|
Attachment #275169 -
Flags: approval1.9? → approval1.9+
Comment 7•17 years ago
|
||
jag: thanks for the fix, approved for 1.9!
/be
Comment 8•17 years ago
|
||
jag: forgot to add, please take assignment of this bug -- you fixed it.
/be
Comment 9•17 years ago
|
||
Checked in, finally. I'm really sorry for the long delay!
Assignee: general → jag
Comment 10•17 years ago
|
||
This should be fixed now.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Comment 11•17 years ago
|
||
Checking in 15.9.4.3.js;
/cvsroot/mozilla/js/tests/ecma_3/Date/15.9.4.3.js,v <-- 15.9.4.3.js
initial revision: 1.1
Flags: in-testsuite+
You need to log in
before you can comment on or make changes to this bug.
Description
•