I am trying to change the date format from mm/dd/yyyy to dd/mm/yyyy in a DateInput widget. I am trying to change the format the following way.
class Meta:
model = Patient
fields = '__all__'
widgets = {
'date_of_birth': widgets.DateInput(
format='%d-%m-%Y',
attrs={'type': 'date', 'class': 'form-control'})
}
I noticed that if I don't include the 'type': 'date'
attribute the date is interpreted in the correct format, but in that case the widget isn't displayed but just a text-field. So you have to write the date manually (including /). With the DateInput widget that looks like this with dd and mm switched DateInput widget
I have also tried changing the settings.py
the following way which also didn't help.
LANGUAGE_CODE = 'en-GB'
TIME_ZONE = 'CET'
USE_L10N = True
USE_TZ = True
DATE_INPUT_FORMATS = ('%d/%m/%Y')