Skip to content

Commit

Permalink
Merge pull request #720 from gpbl/gpbl/717-fix-year-parse
Browse files Browse the repository at this point in the history
Fix error for long years (close #717)
  • Loading branch information
gpbl authored May 13, 2018
2 parents 56ea646 + fa873bc commit 14eb77e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/DayPickerInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function defaultParse(str) {
const day = parseInt(split[2], 10);
if (
isNaN(year) ||
String(year).length > 4 ||
isNaN(month) ||
isNaN(day) ||
day <= 0 ||
Expand Down
1 change: 1 addition & 0 deletions test/daypickerinput/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe('DayPickerInput', () => {
expect(defaultParse('2012-2-0')).toBeUndefined();
expect(defaultParse('2012-0-20')).toBeUndefined();
expect(defaultParse('2012-13-20')).toBeUndefined();
expect(defaultParse('20112-13-20')).toBeUndefined();
});
it('should return a parsed date', () => {
const parsed = defaultParse('2018-7-12');
Expand Down

0 comments on commit 14eb77e

Please sign in to comment.