I could not find any examples in the documentation for simple_form on how to provide a default value. Here on line 33 I tried to hard code it, but that didn't work. I'm using Phoenix 1.7.6
25 <.simple_form
26 for={@form}
27 id="weight-form"
28 phx-target={@myself}
29 phx-change="validate"
30 phx-submit="save"
31 >
32 <.input field={@form[:weight]} type="number" label="Weight" step="any" />
33 <.input field={@form[:date]} type="date" label="Date" step="any" value="01.05.1982" />
34 <:actions>
35 <.button phx-disable-with="Saving...">Save Weight</.button>
36 </:actions>
37 </.simple_form>
40 </div>
It's the format you've used for that string. Not sure where you got that from but the format is basically ISO8601, ie. YYYY-MM-DD
:
... value="1982-05-01"
You can also provide an elixir date in {}
s if that's simpler:
... value={~D[1982-05-01]}