You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm working on using this package for the first time and can't figure out the parser options for a Date object in Typescript
Describe the solution you'd like
Expand the Readme or docs to give options for storing more distinct types
Describe alternatives you've considered
I tried:
const [birthdate, setBirthdate] = useLocalStorage<Date>(
'birthdate',
new Date('2005-04-29')
)
Which had to use any cause I could not take Date or string or it would cause a mismatch with the hook.
Additional context
I'm looking to understand this package better and make use of it correctly. So asking for some help here and some improved docs to help the next person.
The text was updated successfully, but these errors were encountered:
hey. I think parser signature is (val: string) => T | undefined and the serializer signature is (value?: T) => string, if you don't want to use generics replace T with Date and it should work. give it a go
Is your feature request related to a problem? Please describe.
I'm working on using this package for the first time and can't figure out the parser options for a
Date
object in TypescriptDescribe the solution you'd like
Expand the Readme or docs to give options for storing more distinct types
Describe alternatives you've considered
I tried:
Which returned a string. That was to be expected.
Then I added:
Which had to use
any
cause I could not take Date or string or it would cause a mismatch with the hook.Additional context
I'm looking to understand this package better and make use of it correctly. So asking for some help here and some improved docs to help the next person.
The text was updated successfully, but these errors were encountered: