Repository navigation
feat: Handle auto parsing Dates from string #33
Replies: 2 comments
|
I think a generic reviver function could be a good idea. However, it makes more sense to pass the reviver function as an optional argument within the toplevel config options of this library so it would not affect all users (like the one's not using dates or not needing any extra parsing). Temporal is still new, but this approach could futureproof things. Also, users should be warned of running the regex on every item in the json tree (which has a perf cost on scale). |
|
That sounds great. Three follow-ups:
storageConfig = {
...
preset: ["Date", "BigInt"]
}
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Before submitting a PR, I wanted to have some input for desirability/fit for a feature which handles JS dates.
It would use reviver function to regex test for isoDate string and if so, return Date type.
General idea,
Also should add the support of Temporal types would future proof this is as well.
All reactions