In a model I have a field
filed :my_dt, :naive_datetime
As far as I’ve found out, in Phoenix there’s no Html helper for a date alone which will generate a calendar picker. Therefore, I’m using an html tag for it, and it’s on a LiveView page:
<input type="date" name="my_model[my_dt]" value={@my_dt_without_time} />
That is, the time
part should always remain 00:00
– may be ignored, for now. I don’t need a time zone either, the UTC should be used.
How will I properly bind a my_dt
to the date
tag such that
a) it’ll show itself properly, whenever my_dt
is present in the DB; and
b) it’ll get edited and updated properly too
?
I’m aware that it’ll require pre-formatting it on backend and post-processing, and this will be ok.