I have a Date input field in my form like below.
<label class="form-label">Date of Birth</label>
{{ form.date_of_birth }}
{% if form.date_of_birth.errors %}
<div class="alert alert-danger">{{ form.date_of_birth.errors }}</div>
{% endif %}
I am trying to insert date 08/06/2024
. I am getting error Enter a valid date.
. I am using below code in forms.py
.
date_of_birth = forms.DateField(
required=True,
input_formats=['%d/%m/%Y']
)
I am using below code in settings.py
.
DATE_INPUT_FORMATS = ['%d/%m/%Y']