update 更新待办日历初始周的计算方法

This commit is contained in:
2026-03-03 17:21:36 +08:00
parent 4fae8b42fb
commit df97bd3512

View File

@@ -89,9 +89,9 @@ const getWeek = function () {
// 将周日(0)转换为7以便于计算
const adjustedFirstDay = firstDay === 0 ? 7 : firstDay;
// 计算当前日期是本月的第几周
// 公式:当前日期 + (调整后的第一天星期几 - 2) 然后除以7向上取整
// 减2是因为周一是一周的开始,所以如果第一天是周一(1),那么不需要额外天数
return Math.ceil((dayOfMonth + adjustedFirstDay - 2) / 7);
// 公式:当前日期 + (调整后的第一天星期几 - 1) 然后除以7向上取整
// 减1是因为如果第一天是周一(1),那么它应该是第一周的开始
return Math.ceil((dayOfMonth + adjustedFirstDay - 1) / 7);
};
const reminders = ref([]);