Opened 10 years ago

Closed 10 years ago

#9423 closed defect (fixed)

test_Calendar.html BigCalendar shows wrong date

Reported by: youngho Owned by: Adam Peller
Priority: high Milestone: 1.4
Component: Dijit Version: 1.3.0
Keywords: Calendar Cc: Douglas Hays
Blocked By: Blocking:

Description

In test_Calendar.html the BigCalendar? shows today not input value date '2008-03-15'.

Change History (6)

comment:1 Changed 10 years ago by Adam Peller

Milestone: tbd1.4
Owner: set to Adam Peller
Status: newassigned

Apparently the value attribute doesn't work on any Calendars at startup!

comment:2 Changed 10 years ago by Adam Peller

Resolution: fixed
Status: assignedclosed

(In [18028]) Fixes #9423. !strict youngho, thanks for reporting this.

comment:3 Changed 10 years ago by haysmark

Resolution: fixed
Status: closedreopened

I noticed starting with [18028] all of the Calendar entries are NaN in IE8 in Quirks mode. You can reproduce this behavior in the current trunk in IE8 using themeTesterQuirk:

http://archive.dojotoolkit.org/nightly/checkout/dijit/themes/themeTesterQuirk.html

Specifically:

  • The month is "undefined"
  • The days are "NaN"
  • The years are "NaN"

You can also reproduce this with test_Calendar after you remove the doctype, so it's definitely not a themeTesterQuirk bug. Strangely in this test the giant calendar works fine and only the standard calendar is broken.

The other browsers are unaffected and IE8 Strict works fine. Talk about obscure . . .

comment:4 Changed 10 years ago by Adam Peller

Cc: Douglas Hays added

haysmark, thanks for noticing this. I'm not sure this is a problem in the Calendar code, only that it's honoring an optional value attribute where it didn't before. The parser seems to have quirky behavior in IE wrt optional Dates. The bug occurs when the value is not specified for the calendar. It is expected to default to the current date.

In parser.js instantiate() around line 156, attributes.getNamedItem("value") returns null in IE8 standards mode, but "" in quirksmode. Then, because of a kludge where "" represents a special invalid Date, we get NaN as the start date (and eventually, all dates calculated from it)

I could work around this in the calendar by replacing the NaN date with today's date at instantiation, but I'd like to better understand this parser issue.

comment:5 Changed 10 years ago by bill

I'm also seeing the NaN problem in test_Calendar.html (which is strict mode) on IE6.

IIRC we already handle this in other widgets like NumberTextBox and DateTextBox... those widgets' value is NaN by default, so if the parser tells them that value=NaN (even if the user hasn't specified any value at all), there's no impact.

The reason (IIRC) is that for <input> controls we can't tell whether the markup specified value="" or no value at all. (Obviously value="" is invalid syntax for a number or a date, so it's NaN in our code.)

So sounds like it makes sense for Calendar, since it doesn't support the idea of having no selected date, to convert NaN to today.

comment:6 Changed 10 years ago by Adam Peller

Resolution: fixed
Status: reopenedclosed

(In [18473]) Avoid initial value=NaN setting on IE. Fixes #9423 !strict

Note: See TracTickets for help on using tickets.