diff --git a/lib/dotcom/trip_plan/input_form.ex b/lib/dotcom/trip_plan/input_form.ex index 758c5a6b5a..6456da979e 100644 --- a/lib/dotcom/trip_plan/input_form.ex +++ b/lib/dotcom/trip_plan/input_form.ex @@ -45,7 +45,7 @@ defmodule Dotcom.TripPlan.InputForm do %{ fromPlace: PlanParams.to_place_param(from), toPlace: PlanParams.to_place_param(to), - arriveBy: datetime_type == :arrive_by, + arriveBy: datetime_type == "arrive_by", date: PlanParams.to_date_param(datetime), time: PlanParams.to_time_param(datetime), transportModes: __MODULE__.Modes.selected_mode_keys(modes) |> PlanParams.to_modes_param(), @@ -110,7 +110,7 @@ defmodule Dotcom.TripPlan.InputForm do defp validate_chosen_datetime(changeset) do case get_field(changeset, :datetime_type) do - :now -> + "now" -> force_change(changeset, :datetime, Util.now()) _ -> diff --git a/lib/dotcom_web/components/live_components/trip_planner_form.ex b/lib/dotcom_web/components/live_components/trip_planner_form.ex index e812ec7146..d11032276e 100644 --- a/lib/dotcom_web/components/live_components/trip_planner_form.ex +++ b/lib/dotcom_web/components/live_components/trip_planner_form.ex @@ -20,17 +20,13 @@ defmodule DotcomWeb.Components.LiveComponents.TripPlannerForm do @impl true def mount(socket) do - form = - %InputForm{} - |> InputForm.changeset(@form_defaults) - |> to_form() - - {:ok, - assign(socket, %{ - form: form, - location_keys: InputForm.Location.fields(), - show_datepicker: false - })} + defaults = %{ + form: %InputForm{} |> InputForm.changeset(@form_defaults) |> to_form(), + location_keys: InputForm.Location.fields(), + show_datepicker: false + } + + {:ok, assign(socket, defaults)} end @impl true @@ -46,7 +42,7 @@ defmodule DotcomWeb.Components.LiveComponents.TripPlannerForm do phx-submit="save_form" phx-target={@myself} > -