' '
{
{day.date.split('-')[2]}}
data () {
return {
week: [' ', ' ', ' ', ' ', ' ', ' ', ' '],
currentDay: moment().format('YYYY-MM-DD'),
defaultDate:moment().format('YYYY-MM-DD'),
subN:0,
addN:0,
}
},
methods:{
getDays(day) {
let arr = []
/* */
let weekOfDate = Number(moment(day).format('E'))
// : this.week = [' ', ' ', ' ', ' ', ' ', ' ', ' ']
for (let i = 0; i < this.week.length; i++) {
arr.push(
{
date: moment(day).subtract(weekOfDate - i - 1, 'd').format('YYYY-MM-DD'),
week: this.week[i]
}
)
}
return arr
},
lastWeek(){
this.subN++
let n =this.subN -this.addN
this.currentDay = moment(this.defaultDate).subtract(7*n, 'd').format('YYYY-MM-DD')
},
nextWeek(){
this.addN++
let m =this.addN-this.subN
this.currentDay = moment(this.defaultDate).add(7*m, 'd').format('YYYY-MM-DD')
},
today(){
this.currentDay=moment().format('YYYY-MM-DD');
},
}
import moment from "moment";