Skip to content

Commit f97a34d

Browse files
committed
Date parser: Assert numeric token.value is not NaN
Fixes #696
1 parent b32457c commit f97a34d

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/date/tokenizer.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,10 @@ return function( value, numberParser, properties ) {
493493
return false;
494494
}
495495

496+
if ( numeric && isNaN( token.value ) ) {
497+
return false;
498+
}
499+
496500
tokens.push( token );
497501
return true;
498502
});

test/unit/date/parse.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ QUnit.test( "should parse composite of date fields", function( assert ) {
409409
// Loose matching: ignore control characters.
410410
date1 = new Date( 2010, 8, 15 );
411411
assert.dateParse( "15/9/2010", "d\u200f/M\u200f/y", cldr, date1 );
412+
413+
// Test #696 - Mix of numbering systems.
414+
assert.dateParse( "15/٧/2010", "d/M/y", cldr, null );
412415
});
413416

414417
/**

test/unit/date/tokenizer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ QUnit.test( "should tokenize day (d) with no padding", function( assert ) {
342342
lexeme: "2",
343343
value: 2
344344
}] );
345+
346+
// Test #696 - Mix of numbering systems.
347+
assert.dateTokenizer( "٧", "d", cldr, [] );
345348
});
346349

347350
QUnit.test( "should tokenize day (dd) with padding", function( assert ) {

0 commit comments

Comments
 (0)