In document:

Dropdown:

General info:

One of the goals with the original DatePicker widget was to not build it specifically into a container widget. That way, it would be flexible for someone to place it into whatever container type they found to be most useful. To just include a date picker in the page, you can use the following simple markup: <div dojoType="datepicker"></div>

To get the value out of the DatePicker, you can either read the value of the DatePicker instance's storedDate property

dojo.widget.byId("foo").storedDate;

Or, to be updated any time the value changes, you can connect to the setDate method to listen for any change in the DatePicker's stored value:

                        function handler(rfcDate) {
                                dojo.debug(rfcDate);
                        }
                        dojo.event.connect(dojo.widget.byId("foo"), "setDate", handler);
                

Note that the date is returned in an RFC3339 date format, of the form 2005-06-30T08:05:00-07:00

Dropdown version

The most common use case for a DatePicker is a small dropdown icon representation that is connected to a form field. The example makes a somewhat naive attempt at syncing the value in form field with the value displayed in the DatePicker. It also shows the usage of throwing together a quick custom widget in a custom namespace.