mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-12-07 06:14:24 +00:00
There's no guard against unparsed characters at the end of the date string, any extra characters are just ignored
Fixes #7244 - Datepicker: parseDate() does not throw an exception for long years
This commit is contained in:
parent
ba6dd5c180
commit
92b0f6702a
@ -29,4 +29,13 @@ test('Ticket 6827: formatDate day of year calculation is wrong during day lights
|
||||
equals(time, "089");
|
||||
});
|
||||
|
||||
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
vendored
3
ui/jquery.ui.datepicker.js
vendored
@ -1082,6 +1082,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)
|
||||
|
Loading…
Reference in New Issue
Block a user