Bitwize
Bitwize

Reputation: 190

programmatically set the displayed date for a dijit.calendar

By default the dijit.calendar shows the current date / month. Using the visual controls a user can change the view and choose a date. I need to problematically change the displayed date based on other circumstances.

Upvotes: 1

Views: 2617

Answers (2)

ilovett
ilovett

Reputation: 3388

For anyone else who wants to change the "Displayed Date" and not the "Selected Date" of the calendar, you want the currentFocus of the calendar. That is, the selected value could be Jan 1, 2012, but the calendar is currently displaying December.

Try

// display the month of December 2012
widget.set('currentFocus', Date(2012, 11, 24))

Upvotes: 0

hugomg
hugomg

Reputation: 69934

You can set the value property, similarly to other widgets

//change the calendar's date to just now:
myCalendar.set('value', new Date() )

//change the calendar's date to Christmas eve
myCalendar.set('value', new Date(2012, 11, 24) )

Upvotes: 5

Related Questions