getData() {
let _that = this
var currentFirstDate
var formatDate = function (date) {
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate() + ''
var week = ['Sun', 'Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'][date.getDay()]
return {
year,
month,
day,
week,
}
}
var addDate = function (date, n) {
date.setDate(date.getDate() + n)
return date
}
var setDate = function (date) {
var week = date.getDay() - 1
date = addDate(date, week * -1)
currentFirstDate = new Date(date)
for (var i = 0; i < 7; i++) {
_that.dataList.push(formatDate(i == 0 ? date : addDate(date, 1)))
}
}
setDate(new Date())
},
[{"year":2022,"month":5,"day":"16","week":"Mon"},{"year":2022,"month":5,"day":"17","week":"Tues"},{"year":2022,"month":5,"day":"18","week":"Wed"},{"year":2022,"month":5,"day":"19","week":"Thurs"},{"year":2022,"month":5,"day":"20","week":"Fri"},{"year":2022,"month":5,"day":"21","week":"Sat"},{"year":2022,"month":5,"day":"22","week":"Sun"}]
getDataToday() {
return ['Sun', 'Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat'][new Date().getDay()]
},