bug fix: 日历显示错误

This commit is contained in:
CounterFire2023 2024-04-17 13:14:29 +08:00
parent d971c0e4b6
commit 6c5e45f7c7

View File

@ -44,14 +44,16 @@ export default {
methods: {
//
generateMonth() {
const days = Math.floor((this.activityData.endTime - this.activityData.startTime) /ONE_DAY)
let beginTime = new Date(this.activityData.startTime)
let endTime = new Date(this.activityData.endTime)
let i = 0
const now = getDayBegin(new Date())
for(let i = 0; i < days; i++ ){
while(beginTime <= endTime) {
let current = i * ONE_DAY + this.activityData.startTime
if(current <= this.activityData.endTime) {
const type = current < now ? -1 : 0
this.current.push({day: formatDate(new Date(current)), type, time: current, index: i + 1})
}
beginTime = new Date(current)
const type = current < now ? -1 : 0
this.current.push({day: formatDate(new Date(current)), type, time: current, index: i + 1})
i++
}
this.getCheckInit()
},