Samik Chattopadhyay
Samik Chattopadhyay

Reputation: 1850

dijit.form.DateTextBox set date range

I need to pick birth date and the condition is user must be older than 18 years and less than 100 years. How to set constraints for dijit.form.DateTextBox? Please anyone help me to do so.

Upvotes: 1

Views: 2049

Answers (2)

thecoolmacdude
thecoolmacdude

Reputation: 2277

Require dojo/date and name the parameter in your require statement date.

Then do something like:

dateTextBox.set("constraints", {
    min: date.add(new Date(), "year", 18),
    max: date.add(new Date(), "year", 100)
});

Upvotes: 0

simondiercks
simondiercks

Reputation: 50

try the following:

var test2 = new dijit.form.DateTextBox({
    constraints: {
        min: dojo.date.add(new Date(),"year",18),
        max: dojo.date.add(new Date(),"year",100),
    }
},document.createElement("div"));

Greetings, Simon

Upvotes: 1

Related Questions