Django date format puzzle in multi language app - SHORT_DATE_FORMAT not used with English
We use Django 4.2.11 and I have a bit of a date format puzzle regarding localization in different languages in our project.
We are using jquery datepicker and configure it with the current active language. The behaviour of date fields is consistent in languages such as German, Italian and French. Dates are displayed according to the SHORT_DATE_FORMAT
of Django, and the returned dates of datepicker show the same formatting.
Only with English it's different. The SHORT_DATE_FORMAT
is defined as being m/d/Y
- but the date get's displayed in the form of YYYY-MM-DD
. This leads to the weird behaviour that the user gets displayed a date like for instance 2024-09-08 and when chosing a date from the datepicker the same field shows a value of 09/08/2024. But still the form can be saved without errors and the date is handled correctly.
The date field is defined as declarationDate = models.DateField()
in the model. We are using django-crispy-forms 2.1 with bootstrap 5.
Any ideas what goes wrong here? Where can I look? (I've looked for some time now ...)