Closed Bug 961086 Opened 10 years ago Closed 10 years ago

description of "year" parameter in the JavaScript Date constructor documentation seems incorrect

Categories

(Developer Documentation Graveyard :: JavaScript, defect, P5)

All
Other
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gontronix, Assigned: bruant.d)

References

()

Details

(Whiteboard: c=JavaScript u=webdev p=0)

Attachments

(1 file)

:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: 26 Branch
 Technical Contact: 

:: Details

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

States under the year parameter:

year
Integer value representing the year. The year must always be provided in full (e.g. 98 is treated as 98, not 1998).

However, that does not seem correct:

The description of the constructor is:
new Date(year, month [, day, hour, minute, second, millisecond]);

When creating a date like this:   
new Date(98, 1, 1) 

The result is Date {Sun Feb 01 1998 00:00:00 GMT+0000 (GMT Standard Time)}

The year displayed is 1998 not 98, which seems to be the opposite of what the parameter description states.
Summary: description of "year" parameter in the JavaScript Date constrcutor documentation seems incorrect → description of "year" parameter in the JavaScript Date constructor documentation seems incorrect
Added a screenshot showing the results of Date object creation when using the Date constructor new Date(year, month [, day, hour, minute, second, millisecond]);
Thanks for reporting this. I updated the parameter description and added a small example:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#Two%20digit%20years

Feel free to add more details or review these changes as the Mozilla Developer Network is a community driven wiki where everyone is welcome to share knowledge :-)
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: