Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Commit

Permalink
Fix incorrect DateType validator
Browse files Browse the repository at this point in the history
  • Loading branch information
artkravchenko committed Apr 1, 2017
1 parent 0056598 commit b7c20bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/definitions/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const Email = (reify: Type<Email>);
Email.addConstraint(isEmail);

export const isDate = (x: string): boolean => {
if (new Date(x).toString() === 'Invalid date') {
if (!x.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:.\d{1,3})?Z$/)) {
return 'must be a valid date string';
}
};
Expand Down

0 comments on commit b7c20bf

Please sign in to comment.