W09-2025
Request: http://localhost:5173/dashboard/doctor-schedules?week=2025-W09
Hope: Week start: 2025-02-24
Problem: Week start: 2025-03-03
Reason: week_start = datetime.datetime.strptime(week_str + '-1', '%Y-W%W-%w').date()
Lỗi này xảy ra vì ISO week numbering (tuần ISO-8601) khác với tuần lịch tiêu chuẩn.
datetime.strptime(week_str + '-1', '%Y-W%W-%w')
sử dụng %W (week number), nhưng %W
tính tuần theo chuẩn Django/Python, không phải ISO 8601.week_start = datetime.datetime.strptime(week_str + '-1', '%G-W%V-%u').date()
Bạn nên sử dụng %G-W%V thay vì %Y-W%W, vì:
%G
: Năm theo chuẩn ISO 8601.%V
: Tuần theo chuẩn ISO 8601.%u
: Ngày trong tuần (1 = Thứ Hai, 7 = Chủ Nhật).