DATE parse function crashes in SQLite #17287
Labels
pending-approval
Bug reports that have not been verified yet, or feature requests that have not been accepted yet
type: bug
Issue Creation Checklist
Bug Description
In SQLite, if a field stores a timestamp as a number and is set to type DATE, it will cause Sequelize to crash when performing
findAll()
.Reproducible Example
Here is the link to the SSCCE for this issue:
https://github.com/Skywt2003/sequelize-sscce
It seems that the problem is caused by the lack of type checking inside the
data-types.js
file. In detail, here's the relevant code:Obviously, the parse function assumes the
date
argument is a string withincludes
method. However whendate
is a number, it crashes.Maybe a
toString()
method should be added here. Referring to the MariaDB version ofparse
function inDATE
:What do you expect to happen?
Sequelize should handle timestamp data (in the format of number) correctly, at least without crashing.
What is actually happening?
Sequelize crashes when performing a
findAll
query.Environment
Would you be willing to resolve this issue by submitting a Pull Request?
Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.
The text was updated successfully, but these errors were encountered: