Closed Bug 297300 Opened 20 years ago Closed 11 years ago

A date read from a form by JavaScript is not interpreted properly. Possibly due to use of Date.getYear()

Categories

(Tech Evangelism Graveyard :: English Other, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: twk21, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

URL showing Problem:
http://www.junction.co.uk/HTMLTemplates/information/join_the_e-list.htm
JavaScript: http://www.junction.co.uk/HTMLTemplates/j5_information_join_e-list.js

I don't think the code associated with getYear() is functioning Correctly.
The code operates with the correct behaviour under IE.

In Java 1.3 this method has been replaced, but in the langauge specification
it's kept for backwards compatibility.

Reproducible: Always

Steps to Reproduce:
1. Fill Out Form with valid Details including valid DOB with age (15-100)
2. Press Submit
Actual Results:  
Error Message Saying "14/11/1985" is not a valid date...." [you need to be 14+
and less than 100].

Expected Results:  
Verified that the age of someone born in 1985 is 14+.
Code works correctly in IE.
getFullYear() should be used for the correct result
Assignee: general → english-other
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → English Other
Ever confirmed: true
Product: Core → Tech Evangelism
QA Contact: general → english-other
Version: Trunk → unspecified
See ECMA-262 Edition 3, informative annex section B.2.4, Date.prototype.getYear.
 IE does not follow this.

/be
If this comes up enough, we could emulate IE's behavior.  It would be better to
evangelize all such sites to use getFullYear.

/be
It has been a reoccurring problem over the years. Most sites which have
attempted to work cross browser already deal with it, but it still comes up on
IE-centric and older less professionally maintained sites. I'm okay with staying
the way we are now. I get 15 bugs in TE with getYear and getFullYear in
comments, with two open and 63 total in all products including TE. Not a huge
number...
Offending page and script are 404 now.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in before you can comment on or make changes to this bug.