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)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 22964

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());
}
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
Verified Duplicate - 
Status: RESOLVED → VERIFIED
Closing. 
Status: VERIFIED → CLOSED
Status: CLOSED → UNCONFIRMED
Resolution: DUPLICATE → ---

*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.