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
Passing a validate function in rules should just work, ideally. That might require reworking rulesTmp, however. One option might be to have rulesTmp put the user's validate function in a subproperty of validate, although it would mess with looking up errors manually from the errors object.
This might be OK if appropriately documented.
Steps to reproduce 🕹
Steps:
The text was updated successfully, but these errors were encountered:
@jlai, the DatePicker/DateTimePicker/TimePicker components use the validate property within the rules prop as an object. This enables internal validations for props such as shouldDisableDate, shouldDisableMonth, disablePast, shouldDisableYear, minDate, and more.
If we treat validate as a function instead of an object, then it will leave us with no effective way to apply these internal validations.
Duplicates
Latest version
Current behavior 😯
react-hook-forms allows you to pass either an object or a function as the
validate
param, e.g.but react-hook-form-mui seems to expect only an object
You can work around this by nesting the rule:
but ideally that wouldn't be necessary.
Expected behavior 🤔
Passing a
validate
function in rules should just work, ideally. That might require reworking rulesTmp, however. One option might be to have rulesTmp put the user's validate function in a subproperty of validate, although it would mess with looking up errors manually from the errors object.This might be OK if appropriately documented.
Steps to reproduce 🕹
Steps:
The text was updated successfully, but these errors were encountered: