Closed
Bug 251568
Opened 20 years ago
Closed 20 years ago
error operating date in JavaScript
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
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:
Reporter | ||
Updated•20 years ago
|
Summary: error operating data in JavaScript → error operating date in JavaScript
Comment 1•20 years ago
|
||
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
Reporter | ||
Comment 2•20 years ago
|
||
> 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 → ---
Comment 3•20 years ago
|
||
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 ago → 20 years ago
Resolution: --- → DUPLICATE
Comment 4•20 years ago
|
||
Verified. You have to use getFullYear(), see bug 45764 comment 1.
Status: RESOLVED → VERIFIED
Updated•20 years ago
|
Status: VERIFIED → UNCONFIRMED
Resolution: DUPLICATE → ---
Comment 5•20 years ago
|
||
*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago → 20 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•