[FIX] website_blog: babel yyyy vs YYYY

In the format_date function of babel.dates, there is a difference
between `yyyy` and `YYYY`.
`YYYY` should only be used in combination with the week number.

See issue https://github.com/python-babel/babel/issues/419

closes odoo/odoo#42735

Related: odoo/enterprise#7536
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
wan
2020-01-06 16:23:29 +00:00
parent 126a2e08ec
commit 0385745dd4
+1 -1
View File
@@ -50,7 +50,7 @@ class WebsiteBlog(http.Controller):
tzinfo = pytz.timezone(request.context.get('tz', 'utc') or 'utc')
group['month'] = babel.dates.format_datetime(start, format='MMMM', tzinfo=tzinfo, locale=locale)
group['year'] = babel.dates.format_datetime(start, format='YYYY', tzinfo=tzinfo, locale=locale)
group['year'] = babel.dates.format_datetime(start, format='yyyy', tzinfo=tzinfo, locale=locale)
return OrderedDict((year, [m for m in months]) for year, months in itertools.groupby(groups, lambda g: g['year']))