GeoffZhu/vue-event-calendar

toDate function does not update selected date properly?

Opened this issue · 0 comments

this happens in vue-event-calendar
the watch property must be updated to the current date without 0s when toDate function hits

calendarParams () {
if (this.calendarParams.curEventsDate !== 'all') {
let events = this.events.filter(event => {
return isEqualDateStr(event.date, this.calendarParams.curEventsDate)
})
this.selectedDayEvents = {
// date: this.calendarParams.curEventsDate, // <-- instead of this line
date: this.calendarParams.curEventsDate.split('/').map((item) => {
return parseInt(item, 10)
}).join('/'), // <-- this fixed it
events
}
} else {
this.selectedDayEvents = {
date: 'all',
events: this.events
}
}
},

or if you are using moment you could just pass in moment(date).format('YYYY/M/D') within your toDate fn, incase you don't wanna change the inner component layer