Closed Bug 379104 Opened 18 years ago Closed 18 years ago

new Date(2007,5,0) should reflect May 31, 2007, not June 1, 2007

Categories

(Rhino Graveyard :: Core, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jag+mozilla, Unassigned)

Details

Attachments

(2 files)

There's a small bug in NativeData.java in how the Date constructor and the UTC function handle the value for the day-of-month component. Currently both map anything less than 1 to 1. According to ECMA-262 (3rd), section 15.9.1.12 step 8, the value should simply be added as-is. See also bug 9523 and change 3.19 to jsdate.c Note that bug 9523 didn't update the date_UTC(...) function, I'll file a bug on that shortly. The Date constructor bug was found and fixed by Ilya Frank <ifrank@danger.com>, a colleague of mine at Danger Inc. Based on that I discovered and fixed the UTC function version of the bug.
See bug 363578 for fixing the UTC function in jsdate.c.
Attachment #263106 - Flags: review?(szegedia)
Comment on attachment 263106 [details] [diff] [review] Same, but with most of the shared code factored out Looks okay. Also a nice refactoring to eliminate some code duplication.
Attachment #263106 - Flags: review?(szegedia) → review+
Committed the patch to CVS.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Cool! Thanks for checking this in. Is there a test we can/should update?
Adding target milestone of 1.6R6 based on the date this bug was resolved FIXED.
Target Milestone: --- → 1.6R6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: