Closed woodman231 closed 1 year ago
Hi @woodman231! I agree this is not related to SuperJSON. To me, it looks like this is something with a timezone difference between your browser and server. Maybe this post could help you understand what's going on: https://www.ursahealth.com/new-insights/dates-and-timezones-in-javascript
This may not be a bug with this package specifically, but I am having a hard time with dates. Just doing an example application right now for "Todos", I am using the entire T3 stack with with trpc and superjson as a transformer.
For the moment I am using MS SQL and Prisma. I am using a Prisma type of DateTime, but using @db.Date in my definition. My Zod validators are using the z.Date().nullable in the correct places.
When I create a TODO the date shows correctly, and shows correctly in the database, but when I receive the date, it has been localized. For now I am running the client and the server on the same machine. So I am not sure what I am doing wrong.
Here are a few snippets of code and screen shots.
part of schema.prisma
How I am creating my models. This is the createTodoRequest.ts file
The route handler is then defined as such
Then I use the models with my react-hook-form ...
When the record is created in the database it is what I would expect.
However, when I use my query to retrieve the data it comes back like this
This is how I define my getAllRoute and here is a screen shot of what it looks like for that console.log before it is sent to the client (before superjson get's it).
Any suggestions on what I can do?
If it helps. This is also the full server side entry for my trpc
And this is my entry point for the client of trpc