Hello,
complementing template filters, sometimes it is necessary to format dates also
in Python code, that is, achieve the equivalent to
{{ value|date:"M" }}
For this, I'm using
from django.utils import dateformat
dateformat.format(value, "M")
(This works in Django views and in test cases, but not in `./manage.py shell`.)
As `dateformat.format()` is not covered in
https://docs.djangoproject.com/en/2.1/ref/utils/, but still very useful e.g. in
tests, my question is if this is the correct way to achieve in Python what the
`date` template filter does? Are there alternatives? (`strftime()` does not
provide translated months names etc., and so isn't).
Best regards,
Carsten