react-hook-form
react-hook-form copied to clipboard
issue: Date with useController is loosing extra properties
Version Number
7.62.0
Codesandbox/Expo snack
https://codesandbox.io/p/devbox/priceless-wing-3knqdk
Steps to reproduce
- Go to reproduction URL
- Wait 1 sec for onChange to be called
- See expected and actual values are different
The issue is probably caused by the cloneObject and the fact that TZDate is extended from Date. However, I find current behaviour confusing since it does not allow to store any decedents of Dates.
Expected behaviour
Value string should be same as expected
What browsers are you seeing the problem on?
No response
Relevant log output
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
I may file the PR, we just have to determine the way to fix it.
It seems there is no particular way to clone anything than Date if it was extended. For now I see few solutions:
-
value[Symbol.for("constructDateFrom")](value);will do the thing, but would work specifically withTZDate - Get rid of cloning overall