Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exceptional case for isDate #566

Merged
merged 1 commit into from
Sep 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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