Change django date language format

hello everybody,

i use german date metadata in templates (e.g. {{ document.metadata_value_of.date|date_parse|date:“m” }}), as described in the corresponding post here in the forum. I now have the problem, that the django uses the english date language format and thus month and days are swapped in the output results. As described in the Django reference, i probably have to change the LANGUAGE_CODE to german in the mayan django settings. But since i’m a newbie in such things, i’m not sure if this is the correct way. Any advise i would be appreciated.

Hi,

The issue here is not Django, but the date parsing library, more precisely the way we use the library. Changing the LANGUAGE_CODE value will have not effect.

https://dateutil.readthedocs.io/en/stable/parser.html

In order to make it easy to use, we encapsulate this library as filter to convert the date text string to a date object. Using a filter is easier but does not allow passing arguments.

Seem we’ll need to update this encapsulation to a tag to allow passing the dayfirst argument to solve your situation.

I’ve added this item to our work list for next version.

Thanks for bringing this up.

Many thanks for the information and help :slightly_smiling_face: