Invalid Date when using sequelize.query #17116
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
When I am using sequelize.query to get data like this
sequelize.query( 'SELECT * FROM (SELECT p.*, (st_distance_sphere(POINT(a.latitude, a.longitude), POINT($lat, $lng))/1000) AS distance FROM Pharmacies p INNER JOIN Addresses a ON a.id = p.addressId WHERE p.brandCode = $brandCode OR $brandCode IS NULL) as C WHERE distance <= $maxDistance ORDER BY distance', { bind: { lat: cords?.lat || userLat, lng: cords?.lng || userLng, maxDistance, brandCode: brandCode || null, }, // raw: true, // type: QueryTypes.SELECT, model: Pharmacy, }, )
I am getting all the date columns as Invalid date.
However
models.Pharmacy.findAll()
everything works as expectedmysql2 to 3.5.2
everything works as expectedWhat do you expect to happen?
Date column values to be a valid Date
What is actually happening?
Date column values are Invalid Date
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: