Replies: 2 comments
-
you can pass your own serializer / deserializer. I recommend superjson |
Beta Was this translation helpful? Give feedback.
0 replies
-
I always store dates as ISO strings when dealing with any data.
My guess is you can override this type from your codegen step itself. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Has anyone tackled the issue of deserializing dates contained in queries while using PersistQueryClientProvider?
I understand this is not trivial since JSON does not have a type for Date, nonetheless it seems a common use case and I could not find any reference in the docs or previous questions.
I just started using the provider with React Native and the async storage persister: the app is immediately usable in offline mode, which I like, but all dates are broken! Dates are currently received from the API in ISO 8601 format, but they are casted to Date by our autogenerated TS API client, which gets called into the Tanstack query callbacks: any suggestion to obtain automatic rehydration when data is read from the storage?
Beta Was this translation helpful? Give feedback.
All reactions