Dates not parsed from useLoaderData ? #634
-
Hi everyone, I returned an object with a date property from my I can map my object property from a string to a date in the front-end of course but it's a bit cumbersome and Remix already makes my life so easier, so I'm surprised ! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
Any data you return from a loader, or if you use the |
Beta Was this translation helpful? Give feedback.
Any data you return from a loader, or if you use the
json
helper, will be sent toJSON.stringify
, so Date objects will be converted to strings, then when Remix reads the data it will doJSON.parse
of that string, butJSON.parse
is not going to revive the date string as a Date object so you will get a string fromuseLoaderData
.