I'm trying to validate a date of birth field on Vue.js to only allow dates before today, but I am unsure of how to implement Javascript to the before attributes or the date_between attributes
I'm trying to do something along the lines of
v-validate="'date_format:DD-MM-YYYY|before:changeDateFormat(new Date(Date.now()))'"
where changeDateFormat() is
changeDateFormat(dateStr) {
if (dateStr != null) {
var date = new Date(dateStr)
var newDate = ("00"+(date.getDate())).slice(-2)+'-'+("00"+(date.getMonth()+1)).slice(-2)+'-'+date.getFullYear()
return newDate
}
return ''
I'm quite new to Vue.js so I apologise if this is a simple question.