-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Infer value of date objects fixes #1952 #1964
Conversation
@jquense seem reasonable? |
Deploy preview ready! Built with commit 4def48c |
@@ -18,6 +18,8 @@ const areAllSameType = list => | |||
const isEmptyObjectOrArray = (obj: any): boolean => { | |||
if (obj === INVALID_VALUE) { | |||
return true | |||
} else if (_.isDate(obj)) { | |||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the below branch not catch this already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it's reported as an empty object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weeiiiird
@@ -129,7 +129,7 @@ function inferGraphQLType({ | |||
}, | |||
}, | |||
resolve(object, { fromNow, difference, formatString }) { | |||
const date = object[fieldName] | |||
const date = object[fieldName].toString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does toISOString()
make more sense as a default? its a bit less culture dependent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh for sure!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to do JSON.parse(JSON.stringify(date)) as date could just be a string so this seemed simplest. The internets say that JSON.stringify uses Date.toISOString under the hood anyways.
Deploy preview failed. Built with commit 4def48c https://app.netlify.com/sites/using-glamor/deploys/59a63d61cf321c54a9547048 |
Yeah! Travis is back to green! |
No description provided.