Show a dated bill row's due date where its rail is hidden

Merged
GA
2mo ago
+49-7

Problem

On the Bills overview, rows in Needs attention and This month show their due date only in the date rail, which is hidden @lg:block against the list's container. Below that width the subline shows the frequency or the attention reason, so the row never says when the bill is due: "Monthly on the 1st", "Partial · $92.50 remaining", "Amount changed". "Today" goes too. That covers every phone, and also a 1280px window with both sidebars open, where #main is about 475px wide.

The date formats were also out of step. The rail and the Next up strip hardcoded "%b %-d", which is English month-first order in every locale (fr, pl and ru define short: "%-d %b", ca "%d de %b"). The sublines go through bills_upcoming_date, which uses the locale's :short format. So one page printed "Sep 6" in the rail and "Oct 01" or "was due Sep 06" in the sublines.

Change

  • Below @lg, a dated row's subline leads with the rail's text, in an @lg:hidden span: "Sep 22 · Monthly on the 22nd", "Today · Amount changed", "Sep 06 · 10 days overdue". Wider lists are unchanged.
  • The rail, the new span and Next up all format through bills_upcoming_date (the locale's :short, or :short_with_year for a date in another year). A small bills_row_date helper keeps the rail and the span printing the same text. Under fr, the rail and Next up print "15 sept." instead of "sept. 15".
  • English now reads "Sep 01" instead of "Sep 1" in the rail and Next up, the same as the rest of the page. Switching en date.formats.short to "%b %-d" would change every view, so it stays out of this PR.

Screenshots

This month at 375:

This month at 375px, before and after, light and dark: after, each subline starts with the due date or Today

This month at 1280 with the sidebar and the AI sidebar open:

This month at 1280px with both sidebars, before and after, light and dark

Needs attention at 375, where the subline goes on to give the reason:

Needs attention at 375px: after, Sep 06 · 10 days overdue

At 1440 only the rail's date format changes:

This month at 1440px: the rail reads Sep 01 instead of Sep 1, sublines unchanged

Validation

  • New controller tests: the narrow-width date on This month rows (a date, and "Today") and on a Needs attention row with its reason; the rail and Next up under fr print the locale's own short date.
  • bin/rails test: 10431 runs, 1 error, ReportsControllerTest#test_a_disposal_carried_in_a_third_currency…, which fails on main today as well (see Notes).
  • DISABLE_PARALLELIZATION=true bin/rails test:system: 180 runs, 1 error, DeclareAndPayBillTest. It only fails locally, because it types a US-format date into a day-first Chrome date field (#3885's first commit fixes it).
  • RuboCop, erb_lint, Biome and Brakeman are clean.

Notes

  • ci / test_unit is red on main and on every PR today. The "third currency" test in reports_controller_test.rb (from #3616) creates an EUR→GBP rate at Date.current.beginning_of_month, and exchange_rates.yml has EUR→GBP rates dated today and yesterday, so the uniqueness validation fails on the 1st and 2nd of every month. It's unrelated to this change.
  • Left for a follow-up: a snoozed row's rail shows its original due date while the overdue reason counts from the snoozed date, so the subline can read "Sep 01 · 10 days overdue" (desktop already showed the same pair). A date in another year ("Dec 28, 2025") wraps onto two lines in the 56px rail.
  • Merges cleanly with the open #3885, which also edits _occurrence.html.erb and bills_helper.rb.

Summary by CodeRabbit

  • Bug Fixes
    • Bill dates show “Today” for occurrences due today and include the year when dates fall outside the current year.
    • On smaller screens, dates appear alongside the bill’s subline; on larger screens, they remain in the date rail.
    • Date labels in the date rail and “Next up” link follow the selected locale’s short-date format.