Skip to content

Commit

Permalink
Add exceptional case for isDate
Browse files Browse the repository at this point in the history
  • Loading branch information
KisukPark committed Aug 17, 2016
1 parent a8b3eba commit ff4a713
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/isDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function isDate(str) {
// check for valid double digits that could be late days
// check for all matches since a string like '12/23' is a valid date
// ignore everything with nearby colons
dayOrYearMatches = str.match(/(^|[^:\d])[23]\d([^:\d]|$)/g);
dayOrYearMatches = str.match(/(^|[^:\d])[23]\d([^T:\d]|$)/g);
if (!dayOrYearMatches) {
return true;
}
Expand All @@ -97,4 +97,4 @@ function isDate(str) {
}
return false;
}
module.exports = exports['default'];
module.exports = exports['default'];
1 change: 1 addition & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,7 @@ describe('Validators', function () {
'2015-10-20T00:53:09+12:00',
'2007-04-06T00:00',
'2010-02-18T16:23:48.5',
'2016-02-20T16:23:48.5',
'200905',
'2009-',
'2009-05-19 14:',
Expand Down

0 comments on commit ff4a713

Please sign in to comment.