0๐
I ended up making a function for each allowed-dates. I hope this helps someone in the future.
in my data I created an empty array for my methods
data: () => ({
...
newMethods: []
}),
in my methods
setAllowedDatesTo(idx) {
this.$set(this.allowedDates, 'To' + idx, val => {
const today = this.$moment(this.formWorks.workdaySchedules[idx].workdayDateFrom, "YYYY-MM-DD")
const maxAllowedDate = today.clone().add(1, "days")
const currentDate = this.$moment(val)
return !today.isAfter(currentDate) && !currentDate.isAfter(maxAllowedDate)
})
}
0๐
Try this
prop:
:to-allowed-dates="(val) => toAllowedDates(val, index)"
Methods:
toAllowedDates(val, index) {
const today = this.$moment(this.schedules[index].dayFrom, "YYYY-MM-DD")
const maxAllowedDate = today.clone().add(1, "days")
const currentDate = this.$moment(val)
return !today.isAfter(currentDate) && !currentDate.isAfter(maxAllowedDate)
}
- [Vuejs]-Use axios in Vue Router Navigation Guard
- [Vuejs]-Vue Component Not Reacting When Vuex Updates
Source:stackexchange.com