0

In my VueJS application I'm using momentjs to validate if the user selected date is today or a future date.

Following is my custom validation rule.

const dateIsToday = (value) => {
    let todayDate = moment();
    let selectedDate = moment(value, "DD-MM-YYYY");
    return moment(selectedDate).isSameOrAfter(todayDate);
};

This rule works with older dates.

But even when user selects a today's date, it shows me the validation message, saying the selected date is invalid .

Instead I should be able to allow the user to select today's date.

Any suggestions to fix this matter?

Volka Dimitrev
  • 275
  • 1
  • 10
  • 28

0 Answers0