From 36627acb605d77e009582e2f4180a2f8a129912b Mon Sep 17 00:00:00 2001 From: Danilo Britto Date: Tue, 6 May 2025 14:32:23 -0500 Subject: [PATCH] Update persisting-store-data.md (#3110) --- docs/integrations/persisting-store-data.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 }, })