Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Changes date parsing to return String if not a valid JS Date #430
This is a good idea for the use case in #429, and we should support it since MySQL supports these partial date values. But IMO this should be disabled by default, as it could easily cause exceptions / other issues in programs that always expect to be given a date object. So I'm +1 on this, but behind some option that is disabled by default.
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
I'm against this being disabled by default, since MySQL has this option enabled by default. And, in cases where the date is invalid, it already returns a string and not a date---albeit "Invalid Date", rather than the actual date. However, not sending the date would be rather confusing to new users who expect the MySQL defaults to work out of the box (like I did). Also, those who expect an actual date are probably only allowing valid dates to be entered into the database, so they won't come across this edge-case.
The older I get, the more I prefer static typing. That being said, JS and MySql both seem to be in the "loose is better" camp ... so I guess it makes sense. So ignore me on this and go ahead with the patch. But don't come yelling at me when your apps blow up / end up being insecure : ).