Fix bug with date/datetime inputs
This commit is contained in:
@ -337,6 +337,16 @@ defmodule OutlookWeb.CoreComponents do
|
||||
"""
|
||||
end
|
||||
|
||||
def input(assigns) when assigns.type in ~w(date datetime-local) and is_struct(assigns.value) do
|
||||
format = case assigns.type do
|
||||
"date" -> "%Y-%m-%d"
|
||||
"datetime-local" -> "%Y-%m-%dT%H:%M"
|
||||
end
|
||||
assigns
|
||||
|> assign(:value, Calendar.strftime(assigns.value, format))
|
||||
|> input()
|
||||
end
|
||||
|
||||
def input(assigns) do
|
||||
~H"""
|
||||
<div phx-feedback-for={@name}>
|
||||
|
||||
Reference in New Issue
Block a user