I'm trying to display the date formatted for the specified language and I'm little surprised to see that:
babel.dates.format_date(date(2017,1,1), 'MMM Y')
u'Jan 2017'
babel.dates.format_date(date(2017,1,1), 'MMM Y', locale='fr_FR')
u'janv. 2016'
This is because Y
is giving you the week year. You need to use yyyy
to get what you expect.
See https://github.com/python-babel/babel/issues/138
print format_date(date(2017,1,1), 'MMM yyyy')
print format_date(date(2017,1,1), 'MMM yyyy', locale='fr_FR')
Jan 2017
janv. 2017