Skip to content
Permalink
Browse files

Merge remote branch 'pgraham/master'

  • Loading branch information...
jzaefferer committed Jun 28, 2011
2 parents effdd5d + 76e2b98 commit 96de2aa04a4e323199ac942b086958d7227f879a
Showing with 16 additions and 3 deletions.
  1. +12 −2 tests/unit/datepicker/datepicker_tickets.js
  2. +4 −1 ui/jquery.ui.datepicker.js
@@ -30,12 +30,22 @@ test('Ticket 6827: formatDate day of year calculation is wrong during day lights
});

test('Ticket #7244: date parser does not fail when too many numbers are passed into the date function', function() {
expect(1);
var date;
try{
var date = $.datepicker.parseDate('dd/mm/yy', '18/04/19881');
date = $.datepicker.parseDate('dd/mm/yy', '18/04/19881');
ok(false, "Did not properly detect an invalid date");
}catch(e){
ok("invalid date detected");
}

try {
date = $.datepicker.parseDate('dd/mm/yy', '18/04/1988 @ 2:43 pm');
equal(date.getDate(), 18);
equal(date.getMonth(), 3);
equal(date.getFullYear(), 1988);
} catch(e) {
ok(false, "Did not properly parse date with extra text separated by whitespace");
}
});

})(jQuery);
@@ -1102,7 +1102,10 @@ $.extend(Datepicker.prototype, {
}
}
if (iValue < value.length){
throw "Extra/unparsed characters found in date: " + value.substring(iValue);
var extra = value.substr(iValue);
if (!/^\s+/.test(extra)) {
throw "Extra/unparsed characters found in date: " + extra;
}
}
if (year == -1)
year = new Date().getFullYear();

0 comments on commit 96de2aa

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