mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Datepicker: reject dates with two year digits when expecting 'yy'
Fixes #8353 Closes gh-1248
This commit is contained in:
parent
bef2c456ca
commit
5730374238
@ -962,7 +962,7 @@ test("parseDate", function() {
|
||||
});
|
||||
|
||||
test("parseDateErrors", function() {
|
||||
expect( 17 );
|
||||
expect( 18 );
|
||||
TestHelpers.datepicker.init("#inp");
|
||||
var fr, settings;
|
||||
function expectError(expr, value, error) {
|
||||
@ -986,6 +986,8 @@ test("parseDateErrors", function() {
|
||||
"3 Feb 01 - d m y", "Missing number at position 2");
|
||||
expectError(function() { $.datepicker.parseDate("dd mm yy", "3 Feb 01"); },
|
||||
"3 Feb 01 - dd mm yy", "Missing number at position 2");
|
||||
expectError(function() { $.datepicker.parseDate("mm dd yy", "2 1 01"); },
|
||||
"2 1 01 - dd mm yy", "Missing number at position 4");
|
||||
expectError(function() { $.datepicker.parseDate("d m y", "3 2 AD01"); },
|
||||
"3 2 AD01 - d m y", "Missing number at position 4");
|
||||
expectError(function() { $.datepicker.parseDate("d m yy", "3 2 AD01"); },
|
||||
|
@ -1138,7 +1138,8 @@ $.extend(Datepicker.prototype, {
|
||||
var isDoubled = lookAhead(match),
|
||||
size = (match === "@" ? 14 : (match === "!" ? 20 :
|
||||
(match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
|
||||
digits = new RegExp("^\\d{1," + size + "}"),
|
||||
minSize = (match === "y" ? size : 1),
|
||||
digits = new RegExp("^\\d{" + minSize + "," + size + "}"),
|
||||
num = value.substring(iValue).match(digits);
|
||||
if (!num) {
|
||||
throw "Missing number at position " + iValue;
|
||||
|
Loading…
Reference in New Issue
Block a user