You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The castValues function is converting string data that is parseable as a date via moment.js ie 20000101 to a date and returning a date object even when the model defines the column as a string:
The issue really becomes a problem because moment.isValid() returns true for something like 20000101 but after running the replace on the value which is a string it's still a string and doing new Date(stripped).valueOf() results in NaN because the value "20000101" is not valid for a Date.
Ideally castValues would just return the string if the model type is string and if it's a date then moment should be used to do the parsing.
I can send a PR if you want.
The text was updated successfully, but these errors were encountered:
The
castValues
function is converting string data that is parseable as a date viamoment.js
ie20000101
to a date and returning a date object even when the model defines the column as a string:The issue really becomes a problem because
moment.isValid()
returns true for something like20000101
but after running the replace on the value which is astring
it's still astring
and doingnew Date(stripped).valueOf()
results inNaN
because the value"20000101"
is not valid for aDate
.Ideally
castValues
would just return the string if the model type isstring
and if it's a date thenmoment
should be used to do the parsing.I can send a PR if you want.
The text was updated successfully, but these errors were encountered: