forms-manager
forms-manager copied to clipboard
Add parse and serializer options for persistState
This is a really helpful tool, thank you.
I use Kendo to handle date pickers and Kendo expects a Date() object for FormControl values:
this.mainForm = this.fb.group({
searchEndDate: [new Date(), Validators.required],
});
With the above, I get a Date() that Kendo consumes.
When I connect the Forms Manager,
this.formsManager.upsert(this.formManagerKey, this.mainForm, {
persistState: true
});
Now 'searchEndDate' is a string
When I add the forms Manager, the date gets converted to a string. Is there a way to get the Forms Manager to maintain the type of the date as a Date()?
No. You can't save a Date
in localstorage.
Hi,
Is there a way to add a custom deserializer JSON.parse() ? in there I can add a Revive function to convert the date string to a date?
This is such a wonderful project you have made, thank you for your kind efforts and work on it.
Ian
You're welcome to submit a PR.