Skip to content

Commit

Permalink
Less strict DateTime scalar #395
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Jul 30, 2020
1 parent 32d088b commit 449e96a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/scalars/iso-date/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ export const validateDate = (datestring: string): boolean => {
// Where *s is a fraction of seconds with at least 1 digit.
//
export const validateDateTime = (dateTimeString: string): boolean => {
/*
const RFC_3339_REGEX = /^(\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60))(\.\d{1,})?(([Z])|([+|-]([01][0-9]|2[0-3]):[0-5][0-9]))$/;
// Validate the structure of the date-string
if (!RFC_3339_REGEX.test(dateTimeString)) {
return false;
}

*/
// Check if it is a correct date using the javascript Date parse() method.
const time = Date.parse(dateTimeString);
if (time !== time) {
Expand Down

0 comments on commit 449e96a

Please sign in to comment.