views:

385

answers:

2

I tried to do this:

dojo.mixin(endDate.constraints, {min: new Date(2009,09,14)});

But as a result I got this:

min    Wed Oct 14 2009 00:00:00 GMT+0200 (CET)

??? It always adds one month! Is this a bug?

But what I actually want to do is something like this:

dojo.mixin(endDate.constraints, {min: dijit.byId("beginDate").date});

This results in:

min    undefined
+2  A: 

It's not a bug - it's a feature! And it's not a feature of Dojo, but JavaScript:

Integer value representing the month, beginning with 0 for January to 11 for December.

In order to debug that error, just use FireBug to see 1) what dijit.byId("beginDate").date returns - a string or a date object?, 2) if it's a string, is it correctly formatted; can new Date parse it?, etc...

Maine
+1  A: 

Ben, as for the second part of your question, there is no date property on a DateTextBox. What you want is the value attribute

dijit.byId("beginDate").attr("value")

which does return a Date object.

peller
by the way, 09 is octal, though browsers seem to pretend it's decimal. Make sure to avoid leading zeros in unquoted numbers.
peller
or pass in a base when running passe int: parseInt('08',10) vs. parseInt('08')
seth