Bug #98347 weekday lastweek of year
Submitted: 24 Jan 2020 17:31 Modified: 24 Jan 2020 21:50
Reporter: Rodrigo Benedito Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:5.7.23-23 OS:CentOS
Assigned to: CPU Architecture:Any

[24 Jan 2020 17:31] Rodrigo Benedito
weekofyear('2019-12-31') return 1. This is a last week of year, is the week 53.
2019-12-29 is sunday and is in week 52, 2019-12-30 and 2019-12-31 are week 1.

How to repeat:
select weekofyear('2019-12-24');
select weekofyear('2019-12-25');
select weekofyear('2019-12-26');
select weekofyear('2019-12-27');
select weekofyear('2019-12-28');
select weekofyear('2019-12-29');
select weekofyear('2019-12-30');
select weekofyear('2019-12-31');

Suggested fix:
In change of year have a new cicle, so, don't considere last day of week in calculation or other days. In first day of year the week is 1.
[24 Jan 2020 21:50] MySQL Verification Team
Thank you for the bug report. Please check: http://week-number.net/calendar-with-week-numbers-2019.html where you could see at the bottom why 2019 has max number of week 52 and then 30/31 December is week 1.