Closed Bug 251568 Opened 20 years ago Closed 20 years ago

error operating date in JavaScript

Categories

(Core :: JavaScript Engine, defect)

x86
Windows Server 2003
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 22964

People

(Reporter: uranium, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; uk-UA; rv:1.7.1) Gecko/20040707 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; uk-UA; rv:1.7.1) Gecko/20040707 Running simple javascript on amy version of mozilla gets strange reszult: <script language="JavaScript"> d = new Date(); day = d.getYear(); document.writeln(day); </script> We receive 104 year. On IE it works well. Reproducible: Always Steps to Reproduce:
Summary: error operating data in JavaScript → error operating date in JavaScript
This is correct behavior. To get your desired result, use getFullYear() instead. *** This bug has been marked as a duplicate of 100123 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
> This is correct behavior. Very strange explanation. Even If this was "correct" in 4.7, this should be fixed. How can I get short year, if I need the short date only? e.g. mm/dd/yy
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Remember the Y2K "millennium bug"? Why do you want two year formats? If you must have them, nothing prevents you from doing it yourself, either with string or number manipulation. Do not reopen this bug again. It was properly resolved as a duplicate, and we are not breaking backward compatibility with what Mozilla JS engines have done since Netscape 2. The getYear/setYear methods are non-normative ECMA extensions which you should avoid. /be *** This bug has been marked as a duplicate of 100123 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → DUPLICATE
Verified. You have to use getFullYear(), see bug 45764 comment 1.
Status: RESOLVED → VERIFIED
Status: VERIFIED → UNCONFIRMED
Resolution: DUPLICATE → ---
*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.