fix(membership-fees): show error for unparseable cycle date instead of crashing

Date.from_iso8601/1 returns {:error, reason}, so the with else clause matching a bare :error never fired and an invalid date raised a WithClauseError. Match the real date/calendar error reasons so the user sees the validation message.
This commit is contained in:
Moritz 2026-06-02 12:08:19 +02:00
parent 2db467d5d1
commit ec6422d450
2 changed files with 23 additions and 1 deletions

View file

@ -1027,7 +1027,7 @@ defmodule MvWeb.MemberLive.Show.MembershipFeesComponent do
|> assign(:create_cycle_error, format_error(error))}
end
else
:error ->
{:error, reason} when reason in [:invalid_format, :invalid_date, :incompatible_calendars] ->
{:noreply,
socket
|> assign(:create_cycle_error, gettext("Invalid date format"))}