Skip to main content

Search and Top Navigation

#4647 closed bug (fixed)

Opened June 30, 2009 05:25PM UTC

Closed July 22, 2009 08:29AM UTC

Last modified May 26, 2010 05:40PM UTC

setDate cannot be called multiple times

Reported by: babaker Owned by:
Priority: major Milestone: 1.8
Component: ui.datepicker Version: 1.7.2
Keywords: datepicker setDate Cc:
Blocked by: Blocking:
Description

It is only possible to call setDate once. Any subsequent calls are ignored and the calendar does not refresh. For example, on any of the datepicker demos, type the following in the firebug console:

$("#datepicker").datepicker("setDate","+1m");

The calendar will change as expected (in this case it went from June to July). But if you call that function again, nothing will happen. Interestingly, if you setDate "-1m", it will jump all the way back to the month previous to the month that was initially displayed on the page (in my case it went all the way from July to May).

The workaround for this is to use the following which appears to work fine:

$.datepicker._adjustdate("#datepicker",+1,"M");

Attachments (0)
Change History (3)

Changed July 05, 2009 05:06AM UTC by kbwood comment:1

The current setDate implementation calculates all relative settings from today, not the currently selected date. So all your calls are working it's just that they're all resulting in the same date. Maybe we need to enhance the relative date string to indicate using the current date rather than today: 'c -1m'?

Changed July 09, 2009 01:57PM UTC by jzaefferer comment:2

milestone: TBD1.8

Changed July 22, 2009 08:29AM UTC by kbwood comment:3

resolution: → fixed
status: newclosed

Fixed in r2955. As suggested, relative date string may begin with a 'c' to be relative to the currently selected date (or today if none selected) rather than the default of today.