Update persisting-store-data.md (#3110)

This commit is contained in:
Danilo Britto 2025-05-06 14:32:23 -05:00 committed by GitHub
parent 95bce2f74c
commit 36627acb60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -462,9 +462,10 @@ const storage = createJSONStorage(() => sessionStorage, {
return value return value
}, },
replacer: (key, value) => { replacer: (key, value) => {
if (value instanceof Date) { // NOTE: the result of `.toJSON()` is passed to the
return { type: 'date', value: value.toISOString() } // replacer function as value if is available so
} // a Date is always a `string` at this point
if (key === 'someDate') return { type: 'date', value }
return value return value
}, },
}) })