Timestamp mode differences?

What is the difference between the timestamp "mode" of "string'"and "date"?
5 Replies
Kairu
Kairuā€¢2y ago
looks like date outputs as a js Date object, string outputs it as a string was actually gonna make a post asking for the ability to cast properties for just this reason, since Date objects cant be serialized between the nextjs server->client boundary seems like i can get rid of superjson now
Andrii Sherman
Andrii Shermanā€¢2y ago
Yeah, it was done in a way to get a full control on date string parsing you can enable mode: string and get raw string from database and then parse to date using specific timezones, etc. and not rely on a way drizzle does string to date mapping
mr_pablo
mr_pabloOPā€¢2y ago
Ah, so its just for how the data is marshalled from the database? Gotya. I thought it had something to do with the creation of the column in MySQL
Andrii Sherman
Andrii Shermanā€¢2y ago
yeah
mr_pablo
mr_pabloOPā€¢2y ago
Excellent, thank you side question (as ive not done mysql for years!) whats the preferred column type for a UNIX timestamp? (the timestamp type in mysql is for ISO style datetimes afaik, eg 2023-05-26 12:30:00) hmm, looks like an unsigned int is the safest approach šŸ˜Ž
Want results from more Discord servers?
Add your server