Is it possible to specify the display format for a dijit.form.DateTextBox

Yes, you can do something like this:

var occursOnField = new dijit.form.DateTextBox({
    constraints: { datePattern : 'yyyy-MM-dd' }
    , promptMessage: "yyyy-MM-dd"
    , invalidMessage: "Invalid date format. Use yyyy-MM-dd"
})

Update Jan 29, 2012:

Chrome and Dojo 1.6.1 compatibility bug.

If the day of month is being padded with too many 0s, use one less d in the date pattern to work around the bug. For example, on Google Chrome 16 and Dojo 1.6.1 : datePattern : 'yyyy-MM-dd' will give 2010-01-001 and datePattern : 'yyyy-MM-d' will give 2010-01-1.

Tags:

Date

Dojo