mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
Update persisting-store-data.md (#3110)
This commit is contained in:
parent
95bce2f74c
commit
36627acb60
@ -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
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user