Opened 14 years ago

Closed 14 years ago

#3968 closed defect (fixed)

parser.js ignoring value="" for dates

Reported by: haysmark Owned by: bill
Priority: high Milestone: 0.9
Component: Parser Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by haysmark)

The parser evaluates this DateTextbox?:

<input id="q14" type="text" dojoType="dijit.form.DateTextbox" value="">

However, instead of using the value of "", the parser ignores the "" and DateTextbox? gets the default class value: a new date. The parser doesn't even go into str2obj, like it does for nonblank values.

Change History (4)

comment:1 Changed 14 years ago by haysmark

Description: modified (diff)
Summary: parser.js sends fromISOString invalid ISO stringparser.js ignoring value="" for dates

comment:2 Changed 14 years ago by haysmark

Investigate the correct behavior of this code:

var attrValue = node.getAttribute(attrName);
145 if(attrValue && !d.isAlien(attrValue)){ // see bug#3074; ignore builtin attributes

attrValue is "", so if(attrValue) returns false even though it is a valid value.

comment:3 Changed 14 years ago by bill

This is a bit bigger issue because in the same way that

<input dojoType=dijit.form.DateTextBox value="">

should be a blank/null/invalid date rather than today's date, also

new dijit.form.DateTextBox();

should be a blank/null/invalid date.

My first instinct is in the prototype to set


but that doesn't work because then the parser doesn't know that value is of type Date.

So it looks like the solution is to use the NaN of Dates, which can be achieved by new Date("") or new Date("xxx")

I'll look at the parser code and make sure that str2obj gets called for "" and that it instantiates an NaN Date.

Also was talk about making value="now" in the parser evaluate to the current date.

comment:4 Changed 14 years ago by bill

Resolution: fixed
Status: newclosed

(In [9951]) Fix parser bugs reading disabled/checked, and also b="false" and foo="" type attributes (which should be obeyed not ignored).

Make date="" convert to an invalid date (the NaN of dates), and date="now" convert to the current date.

Fixes #3682, #3968.

Note: See TracTickets for help on using tickets.