[Vuejs]-How to create custom start/end date Vue custom validator

0👍

Can be solved using the following code:

first create custom validator:

const isAfterDate = (value, vm) => {
    return new Date(value).getTime() > new Date(vm.startDate).getTime();
};

Second, call the validator within validations:

    endDate: {
      required,
      isAfterDate
    }

Leave a comment