#4647 closed bug (fixed)
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");
Change History (3)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Milestone: | TBD → 1.8 |
---|
comment:3 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
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.
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'?