I want to read a localized greek date for my django project. The correct format for greek dates is dd/mm/yy (f.e. 22/2/2012).
Now, I have set my project language (in settings.py) to 'el' (for greek) and I have create a DateInput with localize=True. If I try to enter a dd/mm/yy format I get an error (invalid format) response. On the other hand if I try to enter a mm/dd/yy format it works fine. Also, if I change my project language from 'el' to 'en-GB' (for UK english), the dd/mm/yy format is accepted successfully.
Before going crazy, I took a look at the django source code and more specifically to the file:
https://github.com/django/django/blob/master/django/conf/locale/el/formats.py
which should contain the formats for greece but foun out that the DATE_INPUT_FORMATS
was commented out. On the other hand, the same file for UK English (https://github.com/django/django/blob/master/django/conf/locale/en_GB/formats.py) contained two valid entries for DATE_INPUT_FORMATS
. Could that be related to the problem ?
I know that I can set the widget format (like described in this question Making Django forms.DateField show use local date format) however I'd really like to use the L10N capabilities and not add different date formats for each language I want to support :(