- javascript date problem prevents data display



Tech Evangelism Graveyard
English US
16 years ago
3 years ago


(Reporter: Bob Smith, Unassigned)




(Whiteboard: [technote-needed], URL)


(1 attachment)



16 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3a) Gecko/20021212
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3a) Gecko/20021212

In the site-specific pages accessible from , data and charts should be
displayed after valid dates are selected (and Go is hit).  In Mozilla, an error
message like "You must select a date earlier than today's date. Today is January
5,." is displayed instead. iE 6.0 displays the data and charts.

Reproducible: Always

Steps to Reproduce:
1. Go to URL.
2. Scroll down, select valid previous date such as 04 January, 2002
3. Hit Go.

Actual Results:  
Error message popup is displayed.

Expected Results:  
Display site-specific "Fast Facts" table and solar power chart.

Using default theme, tabs.  Saw other javascript date bugs listed, but didn't
wade through them all (sorry).
The site seems to just be buggy... it basically does:

todays = ((new Date()) + '').split(' ');

and then assumes the last element in the array is the year (it's actually the
timezone name).

Comment 2

16 years ago
*** Bug 187820 has been marked as a duplicate of this bug. ***

Comment 3

16 years ago
Created attachment 110851 [details]
Reduced testcase

Comment 4

16 years ago
Boris' analysis is correct. Load the reduced testcase and hit 'Test'.
In NN4.7 and IE6, the date passes as valid; in Mozilla, it doesn't.

As Boris says, the site assumes that the last element in a JavaScript
date is the year. This is true in NN4.7 and IE6, but not Mozilla.
Just try this HTML:

  var dt = Date().toString();

NN4 --->  Mon Jan 06 23:16:02 GMT-0800 (Pacific Standard Time) 2003
IE6 --->  Mon Jan 06 23:15:59 2003
Moz --->  Mon Jan 06 2003 23:15:56 GMT-0800 (Pacific Standard Time)

That's what's causing the problem. The site should use the getFullYear()
method to get the year (NOTE: don't use the deprecated method getYear()).

Reassigning to Evangelism component -
Assignee: rogerl → bclary
Component: JavaScript Engine → US Gov
Ever confirmed: true
OS: Windows 98 → All
Product: Browser → Tech Evangelism
QA Contact: pschwartau → chrisn
Hardware: PC → All
Version: Trunk → unspecified

Comment 5

16 years ago
common enough to get a short note written about it.
Summary: javascript date problem prevents data display → - javascript date problem prevents data display
Whiteboard: [technote-needed]

Comment 6

15 years ago
tech evang june 2003 reorg
Assignee: bc → english-us
Component: US Gov → English US
QA Contact: chrisn → english-us

Comment 7

15 years ago
contact info
Target Milestone: --- → Oct

Comment 8

14 years ago
still broken
Page no longer exists, closing.
Last Resolved: 4 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.