From 0385745dd42de2c40e412dd248b7e0a5fdf17d7d Mon Sep 17 00:00:00 2001 From: wan Date: Mon, 6 Jan 2020 09:08:30 +0000 Subject: [PATCH] [FIX] website_blog: babel yyyy vs YYYY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- addons/website_blog/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_blog/controllers/main.py b/addons/website_blog/controllers/main.py index e9b4b3af8b1..b5da72a4c6e 100644 --- a/addons/website_blog/controllers/main.py +++ b/addons/website_blog/controllers/main.py @@ -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']))