Skip to content

[timesheets] Fix week list truncation at the ISO year boundary#2103

Open
frankrousseau wants to merge 1 commit into
cgwire:mainfrom
frankrousseau:fix-1928-timesheets-week-53
Open

[timesheets] Fix week list truncation at the ISO year boundary#2103
frankrousseau wants to merge 1 commit into
cgwire:mainfrom
frankrousseau:fix-1928-timesheets-week-53

Conversation

@frankrousseau

Copy link
Copy Markdown
Contributor

Problems

  • In the last week of December, the weekly timesheet showed a single column labelled week 1 with next-year hours, hiding every other week of the year (fixes In the final week of 2025, Timesheets 2025/WEEKS shows only the first week of 2026 with wrong hours. #1928): getWeekRange used moment().week(), which already returns 1 for late-December days.
  • The week header tooltip computed its date span from today's year instead of the displayed one, and the side panel derived the week interval from locale weeks, so the displayed range could be shifted a full week from what the backend (which uses isocalendar/isoweek) actually aggregates.

Solutions

  • getWeekRange now uses isoWeek()/isoWeekYear() and only truncates the range at the current week when today's ISO week belongs to the displayed year, otherwise it lists the full 52/53-week range.
  • The tooltip uses the displayed year, and the side panel derives start/end days from the Monday of the ISO week, matching the backend aggregation; regression tests cover 2025-12-30, 2027-01-01 and a 53-week year.

In the last days of December, moment().week() already returns 1 (the
locale week of the next year), so the weekly timesheet collapsed to a
single wrong column for the whole year (cgwire#1928). getWeekRange now uses
isoWeek()/isoWeekYear(), matching the backend which keys the week table
with date.isocalendar(), and falls back to the full year range when
today's ISO week belongs to another year.

Align the other week computations of the timesheet pages on the same
ISO convention: the header tooltip used today's year instead of the
displayed one, and the side panel derived the week interval from
locale weeks, showing a range shifted from the one the backend
aggregates for years starting on Friday or Saturday.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

In the final week of 2025, Timesheets 2025/WEEKS shows only the first week of 2026 with wrong hours.

1 participant