DB insertion - Date field (mode: string) is using default value instead of passed value
Trying to insert an Order object which has a "pickupTime" Date field to db, but upon insertion the created item uses the model default value instead of the passed date.
This is the insertion :
newOrder pickupTime value before insertion is the follow string : 2023-09-20T14:45:00.000Z
After insertion, the pickupTime value I get is the a Date.now() string (2023-09-19T22:00:00.000Z)
Field configuration in pgTable is :
And finally the insert schema :
Field validation is handled with zod :
insertOrderParams :
(the date field here is not the one I'm interested in)
Any idea what could be happening ?
![No description](https://cdn.answeroverflow.com/1154026309404598393/image.png)
1 Reply
"""Solved""" my own problem by using a timestamp field instead of date. No idea what happened there