Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

fix(transactions): show full dates in the categorize wizard (#2633)

Stephen Jollyc9ca83a0d4b4
diff --git a/app/views/transactions/categorizes/_entry_row.html.erb b/app/views/transactions/categorizes/_entry_row.html.erb
index daba95b7f4..16180bdc33 100644
--- a/app/views/transactions/categorizes/_entry_row.html.erb
+++ b/app/views/transactions/categorizes/_entry_row.html.erb
@@ -6,7 +6,7 @@
aria-label="<%= t("transactions.categorizes.entry_row.include_checkbox", name: entry.name) %>"
data-action="change->categorize#uncheckRule">
<span class="min-w-0 font-medium text-primary truncate"><%= entry.name %></span>
- <span class="text-secondary whitespace-nowrap"><%= l(entry.date, format: :short) %></span>
+ <span class="text-secondary whitespace-nowrap"><%= format_date(entry.date) %></span>
<span class="privacy-sensitive font-medium text-right whitespace-nowrap <%= entry.amount.negative? ? "text-green-600" : "text-primary" %>">
<%= format_money(entry.amount_money.abs) %>
</span>
diff --git a/test/controllers/transactions/categorizes_controller_test.rb b/test/controllers/transactions/categorizes_controller_test.rb
index a3628543e0..1e74d8bbb1 100644
--- a/test/controllers/transactions/categorizes_controller_test.rb
+++ b/test/controllers/transactions/categorizes_controller_test.rb
@@ -26,6 +26,19 @@ class Transactions::CategorizesControllerTest < ActionDispatch::IntegrationTest
assert_response :success
end
+ test "show renders full dates so multi-year lists are unambiguous" do
+ create_transaction(account: @account, name: "Starbucks", date: Date.new(2024, 7, 8))
+
+ get transactions_categorize_url
+
+ assert_response :success
+ # format_date uses the family's date_format preference, every variant of
+ # which includes the year; the previous :short format ("%b %d") did not,
+ # making rows ambiguous when the uncategorized list spans years.
+ expected = Date.new(2024, 7, 8).strftime(@family.date_format)
+ assert_match expected, response.body
+ end
+
test "show renders the first group at position 0" do
2.times { create_transaction(account: @account, name: "Netflix") }
3.times { create_transaction(account: @account, name: "Starbucks") }