Skip to content

Dates not parsed from useLoaderData ? #634

Closed Answered by sergiodxa
QuentinWidlocher asked this question in Q&A
Discussion options

You must be logged in to vote

Any data you return from a loader, or if you use the json helper, will be sent to JSON.stringify, so Date objects will be converted to strings, then when Remix reads the data it will do JSON.parse of that string, but JSON.parse is not going to revive the date string as a Date object so you will get a string from useLoaderData.

Replies: 1 comment 12 replies

Comment options

You must be logged in to vote
12 replies
@kiliman
Comment options

@QuentinWidlocher
Comment options

@kiliman
Comment options

@candidia
Comment options

@mjjabarullah
Comment options

Answer selected by QuentinWidlocher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants