I'm trying to display a date in an input field as so:
<tr><td>Date of Birth</td><td><input type="date" name="DOB" value="{{m.dob|date:"d/m/Y"}}" required=True></td></tr>
where m.dob is defined in the model as:
dob = models.DateField('Date of Birth', blank=True, null=True)
The HTML input tag shows the date as dd/mm/yyyy when the page is loaded but I can see the field has taken the value assigned. How do I get it to display correctly?
Thanks for help
The problem is value="{{m.dob|date:'d/m/Y'}}" which must be specified as value="{{m.dob|date:'Y-m-d'}}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With