Closed lcswillems closed 3 years ago
So Next.js cannot serialize dates, you'll need to use https://github.com/blitz-js/superjson#using-with-nextjs (there is a Next.js example in the docs).
Related https://github.com/vercel/next.js/discussions/11498#discussioncomment-146987
That should work, let me know if if this should be opened again.
Thank you @Jolg42 for your answer! It is what I ended up doing.
Problem
I have a table
Post
with a fieldpublishedAt
of timeDateTime
. The Javascript type given to this field isDate
. However, I would like it to be string or even number (timestamp). How could I do this without having to manually map the field?Additional context
I use Next.js. In
getServerSideProps
, I request latest posts and return them. However, as thepublishedAt
field is of type Date, I get an error from Next.js saying it is not able to stringify it.