File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -962,7 +962,7 @@ test("parseDate", function() {
962
962
} ) ;
963
963
964
964
test ( "parseDateErrors" , function ( ) {
965
- expect ( 17 ) ;
965
+ expect ( 18 ) ;
966
966
TestHelpers . datepicker . init ( "#inp" ) ;
967
967
var fr , settings ;
968
968
function expectError ( expr , value , error ) {
@@ -986,6 +986,8 @@ test("parseDateErrors", function() {
986
986
"3 Feb 01 - d m y" , "Missing number at position 2" ) ;
987
987
expectError ( function ( ) { $ . datepicker . parseDate ( "dd mm yy" , "3 Feb 01" ) ; } ,
988
988
"3 Feb 01 - dd mm yy" , "Missing number at position 2" ) ;
989
+ expectError ( function ( ) { $ . datepicker . parseDate ( "mm dd yy" , "2 1 01" ) ; } ,
990
+ "2 1 01 - dd mm yy" , "Missing number at position 4" ) ;
989
991
expectError ( function ( ) { $ . datepicker . parseDate ( "d m y" , "3 2 AD01" ) ; } ,
990
992
"3 2 AD01 - d m y" , "Missing number at position 4" ) ;
991
993
expectError ( function ( ) { $ . datepicker . parseDate ( "d m yy" , "3 2 AD01" ) ; } ,
Original file line number Diff line number Diff line change @@ -1138,7 +1138,8 @@ $.extend(Datepicker.prototype, {
1138
1138
var isDoubled = lookAhead ( match ) ,
1139
1139
size = ( match === "@" ? 14 : ( match === "!" ? 20 :
1140
1140
( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ) ,
1141
- digits = new RegExp ( "^\\d{1," + size + "}" ) ,
1141
+ minSize = ( match === "y" ? size : 1 ) ,
1142
+ digits = new RegExp ( "^\\d{" + minSize + "," + size + "}" ) ,
1142
1143
num = value . substring ( iValue ) . match ( digits ) ;
1143
1144
if ( ! num ) {
1144
1145
throw "Missing number at position " + iValue ;
You can’t perform that action at this time.
0 commit comments