Closed
Bug 115264
Opened 23 years ago
Closed 20 years ago
Asking a JavaScript Date object for the year returns a non-Y2K compliant value.
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
People
(Reporter: mozilla, Assigned: rogerl)
Details
Pass this function a year that is > 2001 & watch what happens:
function validateDateField(yearText) {
var yearValue=parseInt(yearText);
alert ('The Year Entered Is ' +yearValue);
var month =12;
var day = 12;
var theDate = new Date(yearValue, month-1, day);
alert('The Date Is ' +theDate);
alert('The Year From Date Is ' +theDate.getYear());
}
Comment 1•23 years ago
|
||
The value is correct as designed. getYear() is compatible with the C date
functions and deprecated. getFullYear() is the way to get the year thats correct.
see comments in bug 22964, bug 45764, bug 58241, bug 65681, bug 82354
*** This bug has been marked as a duplicate of 100123 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
Updated•20 years ago
|
Status: CLOSED → UNCONFIRMED
Resolution: DUPLICATE → ---
Comment 4•20 years ago
|
||
*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago → 20 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•