Skip to content
Permalink
Browse files

Datepicker: Fixed #4647 setDate cannot be called multiple times

  • Loading branch information
Keith Wood
Keith Wood committed Jul 22, 2009
1 parent 269a441 commit 61e15b1f76e27596b41d95b2b18c5df7f9eaa89f
Showing with 13 additions and 1 deletion.
  1. +11 −0 tests/unit/datepicker/datepicker_options.js
  2. +2 −1 ui/ui.datepicker.js
@@ -404,6 +404,17 @@ test('setDate', function() {
equalsDate(inp.datepicker('getDate'), date1, 'Set date - two dates');
inp.datepicker('setDate');
ok(inp.datepicker('getDate') == null, 'Set date - null');
// Relative to current date
date1 = new Date();
date1.setDate(date1.getDate() + 7);
inp.datepicker('setDate', 'c +7');
equalsDate(inp.datepicker('getDate'), date1, 'Set date - c +7');
date1.setDate(date1.getDate() + 7);
inp.datepicker('setDate', 'c+7');
equalsDate(inp.datepicker('getDate'), date1, 'Set date - c+7');
date1.setDate(date1.getDate() - 21);
inp.datepicker('setDate', 'c -3 w');
equalsDate(inp.datepicker('getDate'), date1, 'Set date - c -3 w');
// Inline
var inl = init('#inl');
date1 = new Date(2008, 6 - 1, 4);
@@ -1197,7 +1197,8 @@ $.extend(Datepicker.prototype, {
catch (e) {
// Ignore
}
var date = new Date();
var date = (offset.toLowerCase().match(/^c/) ?
$.datepicker._getDate(inst) : null) || new Date();
var year = date.getFullYear();
var month = date.getMonth();
var day = date.getDate();

0 comments on commit 61e15b1

Please sign in to comment.
You can’t perform that action at this time.