Reputation: 330
I want to put a default value in my form.
in my form.html.twig
{% for theme in themes%}
<div class="row">
<div class="text">
<label>date end</label>
<input type="date" name="date_end" value="{{theme.getDateEnd().format('m/d/Y')}}" />
</div>
</div>
{% endfor %}
But it's just do nothing. I tried multiple thing, same result... I don't want to do this with a builder. I want the .html.twig way.
Upvotes: 1
Views: 2469
Reputation: 4825
It should be
{{ theme.getDateEnd|date("Y-m-d") }}
for input date type.
In twig engine, formatting starts with |
character.
http://twig.sensiolabs.org/doc/filters/date.html
Upvotes: 2