Wrong year in format_date for date in first week of year
See original GitHub issueHow to duplicate:
$ python
Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import date, datetime, time
>>> from babel.dates import format_date, format_datetime, format_time
>>> d = date(2016, 1, 2)
>>> format_date(d, format= 'd. MMMM YYYY',locale='en')
u'2. January 2016'
>>> format_date(d, format= 'd. MMMM YYYY',locale='de_DE')
u'2. Januar 2015'
>>>
Package python-flask-babel 0.9-2.1 in Ubuntu 16.04 (older version are affected too)
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Why does formatting a date return the wrong year?
i18n dates are formatted using IntlDateFormatter , which use ISO date format patterns, where YYYY doesn't just mean Full year, but Full week- ......
Read more >Format or DatePar functions return a wrong week number for a ...
For more information and a workaround, see Format or DatePart functions can return wrong week number for last Monday in Year.
Read more >6 Ways to Fix Dates Formatted as Text in Excel
Step 3 of the Wizard: Choose 'Date' from the 'Column Data Format' options and choose your date format from the drop down list...
Read more >Custom Date Formats - Tableau Help
Display the date as a complete date (including day, month, and year), formatted according to your system's short date format setting. The default...
Read more >How to change Excel date format and create custom formatting
The first part of our tutorial focuses of formatting dates in Excel ... you want to convert an American date format (month/day/year) to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Not a bug. Try
yyyy(lower case) instead ofYYYY.According to http://babel.pocoo.org/en/latest/dates.html#date-fields:
y: Replaced by the year. Normally the length specifies the padding, but for two letters it also specifies the maximum length.Y: Same as y but uses the ISO year-week calendar.See also https://en.wikipedia.org/wiki/ISO_week_date.
The documentation was improved by @ldwoolley in #450, so closing. Thanks 😃