mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
The "Due this week" date filter selected the wrong week (it showed next week's cards) and ignored the user's configured start day of week. Root cause: relativeWeek() derived its window from startOf(now(), 'week'), but the native dateUtils.startOf() has no 'week' case, so it returned the date unchanged. The window therefore started at "today + startDayOfWeek" (next week) instead of the beginning of the current week, and never took the configured start weekday into account. Fix: - New Meteor-free helper models/lib/weekStart.js computes startOfWeek(), weekRange() and weekNumberByFirstDay() for an arbitrary start day of week (0=Sunday..6=Saturday, default Monday). Unit tested (positive + negative) in tests/weekStart.test.cjs, including a guard that "this week" must contain today. - client/lib/filter.js relativeWeek() now uses weekRange(now(), weekStartDay, 0|1) so "this week" and "next week" are the correct, non-overlapping Monday..Sunday (or configured) windows. - The this/next-week buttons now toggle per week: clicking the active one clears it, clicking the other switches to it (the old code reset on either state, so you could not switch directly from this week to next week). Thanks to mimZD and xet7.