diff --git a/docs/integrations/persisting-store-data.md b/docs/integrations/persisting-store-data.md index 5040baf2..5656c986 100644 --- a/docs/integrations/persisting-store-data.md +++ b/docs/integrations/persisting-store-data.md @@ -462,9 +462,10 @@ const storage = createJSONStorage(() => sessionStorage, { return value }, replacer: (key, value) => { - if (value instanceof Date) { - return { type: 'date', value: value.toISOString() } - } + // NOTE: the result of `.toJSON()` is passed to the + // 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 }, })