Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes ticket 7244, there's no guard against unparsed characters at th…

…e end of the date string, any extra characters are just ignored. This patch treats that scenario as an error
  • Loading branch information...
commit 686753f7f69c3b1b92dd351b3ea7ea678a7d4b7a 1 parent c08cf8e
Jay Merrifield authored
9 tests/unit/datepicker/datepicker_tickets.js
View
@@ -24,4 +24,13 @@ test('beforeShowDay-getDate', function() {
inp.datepicker('hide');
});
+test('Ticket #7244: date parser does not fail when too many numbers are passed into the date function', function() {
+ expect(1);
+ try{
+ var date = $.datepicker.parseDate('dd/mm/yy', '18/04/19881');
+ }catch(e){
+ ok("invalid date detected");
+ }
+});
+
})(jQuery);
3  ui/jquery.ui.datepicker.js
View
@@ -1074,6 +1074,9 @@ $.extend(Datepicker.prototype, {
checkLiteral();
}
}
+ if (iValue < value.length){
+ throw "Extra/unparsed characters found in date: " + value.substring(iValue);
+ }
if (year == -1)
year = new Date().getFullYear();
else if (year < 100)
Please sign in to comment.
Something went wrong with that request. Please try again.