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

fix: add support for serializing DateTime from ISO date string #12

Merged
2 commits merged into from
Jul 27, 2018

Conversation

ghost
Copy link

@ghost ghost commented Jul 24, 2018

No description provided.

@ghost ghost requested a review from cfnelson July 24, 2018 02:33
Copy link
Contributor

@cfnelson cfnelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor suggested change, though it might not be necessary. Review it before merging otherwise.
Looks good otherwise. 👍 Nice work 🙌

src/DateTime.js Outdated
}

// eslint-disable-next-line no-restricted-globals
if (isNaN(value.getTime())) {
throw new TypeError(`Value is not a valid Date: ${value}`);
if (isNaN(v.getTime())) {
Copy link
Contributor

@cfnelson cfnelson Jul 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential suggestion:
Might be safer to use Number.isNaN() here. I doubt the situation would ever occur were NaN is returned but Number.isNan() is the newer/safer check instead of the global isNaN() and would get rid of your eslint-disable-next-line.

Details here -> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN

@ghost ghost merged commit 0b76be4 into master Jul 27, 2018
@ghost ghost deleted the update-datetime-serialization branch August 31, 2018 14:15
vespertilian pushed a commit to vespertilian/graphql-scalars that referenced this pull request Oct 2, 2020
fix: add support for serializing DateTime from ISO date string
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants