Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

setting a date range using yup on react date picker

const YourSettingSchema = Yup.object().shape({
  dateOfBirth: Yup.string()
    .nullable()
    .test('Date of Birth', 'Should be greather than 18', function(value) {
      return moment().diff(moment(value), 'years') >= 18;
    }),
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #setting #date #range #yup #react #date #picker
ADD COMMENT
Topic
Name
5+4 =