From 17465338428022ff1ab3a414c29d08988cebc580 Mon Sep 17 00:00:00 2001 From: Josh Pigford Date: Thu, 10 Oct 2024 12:24:20 -0500 Subject: [PATCH] Default to "today" when entering a transactions and value entries --- app/views/account/valuations/_form.html.erb | 2 +- app/views/transactions/_form.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/account/valuations/_form.html.erb b/app/views/account/valuations/_form.html.erb index b069c90b..c28597c5 100644 --- a/app/views/account/valuations/_form.html.erb +++ b/app/views/account/valuations/_form.html.erb @@ -9,7 +9,7 @@ <%= lucide_icon("pencil-line", class: "w-4 h-4 text-gray-500") %>
- <%= f.date_field :date, required: "required", min: Account::Entry.min_supported_date, max: Date.current, class: "border border-alpha-black-200 bg-white rounded-lg shadow-xs min-w-[200px] px-3 py-1.5 text-gray-900 text-sm" %> + <%= f.date_field :date, required: "required", min: Account::Entry.min_supported_date, max: Date.current, value: Date.current, class: "border border-alpha-black-200 bg-white rounded-lg shadow-xs min-w-[200px] px-3 py-1.5 text-gray-900 text-sm" %> <%= f.number_field :amount, required: "required", placeholder: "0.00", step: "0.01", class: "bg-white border border-alpha-black-200 rounded-lg shadow-xs text-gray-900 text-sm px-3 py-1.5 text-right" %> <%= f.hidden_field :currency, value: entry.account.currency %>
diff --git a/app/views/transactions/_form.html.erb b/app/views/transactions/_form.html.erb index fd66fb67..050ad297 100644 --- a/app/views/transactions/_form.html.erb +++ b/app/views/transactions/_form.html.erb @@ -18,7 +18,7 @@ <%= f.fields_for :entryable do |ef| %> <%= ef.collection_select :category_id, Current.family.categories.alphabetically, :id, :name, { prompt: t(".category_prompt"), label: t(".category") } %> <% end %> - <%= f.date_field :date, label: t(".date"), required: true, min: Account::Entry.min_supported_date, max: Date.today %> + <%= f.date_field :date, label: t(".date"), required: true, min: Account::Entry.min_supported_date, max: Date.current, value: Date.current %>