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:
parent
2db467d5d1
commit
ec6422d450
2 changed files with 23 additions and 1 deletions
|
|
@ -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"))}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue