rsuite / schema-typed

Schema for data modeling & validation
MIT License
198 stars 28 forks source link

DateType not a valid function - Form Validation #49

Closed blessedjasonmwanza closed 1 year ago

blessedjasonmwanza commented 1 year ago

What version of schema-typed are you using?

"rsuite": "^5.22.0", Nov 13, 2022 - likely 2.0.3

Describe the Bug

I am validating a form date value and Am getting DateType is not a function error in ReactJS. I followed the guidance here but, nothing works.

I'm surprised that the documentation under form validation skipped and did not include date values, why?

Expected Behavior

Show validation message when submit button is clicked Date field is not supplied. - Currently, this is working for String and Number Type, except DateType & MixedType.

To Reproduce

const model = Schema.Model({
startDate: DateType().isRequired('This field is required.'),
})

<Form.Group controlId="start-date-7">
  <Form.HelpText>
    Start date
    <Form.HelpText tooltip>Valid Start Date</Form.HelpText>
  </Form.HelpText>
  <Form.Control name="startDate" style={{ width: 160 }} accepter={DatePicker} />
</Form.Group>
blessedjasonmwanza commented 1 year ago

Issue resolved here