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')
gives the expected value which is:
u'Jan 2017'
while:
babel.dates.format_date(date(2017,1,1), 'MMM Y', locale='fr_FR')
gives me:
u'janv. 2016'
Why is it 2016 not 2017?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With