Skip to content

Fix showSixWeeks page() using aligned span instead of /6 heuristic#2780

Open
Norcy wants to merge 1 commit intowix:masterfrom
Norcy:fix/show-six-weeks-page-span
Open

Fix showSixWeeks page() using aligned span instead of /6 heuristic#2780
Norcy wants to merge 1 commit intowix:masterfrom
Norcy:fix/show-six-weeks-page-span

Conversation

@Norcy
Copy link
Copy Markdown

@Norcy Norcy commented Apr 18, 2026

Problem

When showSixWeeks is true, page() used (daysBefore + monthLength) / 6 >= 6 to decide whether to extend to by 7 days. This does not match the real week-aligned cell count and caused:

  • An extra 7th row in some months (e.g. March 2026 with firstDay=1).
  • Missing trailing next-month cells when the heuristic skipped the extension (e.g. May 2026 stayed at 5 weeks).

Solution

After aligning from and to to week boundaries, extend by one week only when from.diffDays(to) + 1 < 42. Remove the /6 heuristic and the unused daysBefore variable.

Testing

yarn test src/dateutils.spec.js

Made with Cursor

Replace (daysBefore + monthLength) / 6 with week-aligned span check:
extend by one week only when from.diffDays(to) + 1 < 42.

Fixes extra 7th row (e.g. March 2026 with firstDay=1) and missing
trailing next-month cells (e.g. May 2026 staying at 5 weeks).

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant