-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formsy onChange model missing value object methods #379
Comments
Thank you for the first post-2.x bug report! The change appears to date back to formsy 1.0 or just after. However, it's probably been used now in a place or way it wasn't before: Our options as I see them are to:
@aesopwolf do you have any opinions on this? |
Thanks for the quick reply. I have done some reading and I think the |
It doesn't appear so. I'm going to write a test-case to get more definitive information. Also, one additional option is that objects like this just shouldn't be supported. In that case, you would want to use something like an ISO 8601 string as your actual "value" and either use moment only internally in your input component, only external to the form, or in both. What do you think about that? There's some sense in formsy only supporting things that could be sent to or from a server as JSON. |
After some playing yesterday I have worked around it by using the model value to create another moment object.
Makes sense what you are saying about only supporting the JSON so happy for this issue to be closed. |
Released: v2.0.1
|
( complex objects should now be safe ) |
Hi,
For context I have created a datepicker using
withFormsy()
. The date selected by the user is a Moment.js object which has a bunch of methods for manipulating and formatting the date.The model on the Formsy prop
onChange((model)=>{ })
remove all the__proto__
methods on the object.I think this is down to the
cloneIfObject()
method informsy-react/src/utils.ts
Line 47 in 6fcc682
This doesn't seem to be the same behaviour with setting the value using the
setValue()
prop in thewithFormsy
component.This was working pre the v1 to v2 update.
Is the
cloneIfObject
method needed?Many thanks
The text was updated successfully, but these errors were encountered: