ISO Week Number and Week Ordering in Time Histogram
Hey,
Description There are two problems related to the handling of ISO week numbers in the time histogram when visualizing data over the new year period.
Problem 1: Incorrect Week Number for January 1st Observed behavior: January 1st, 2025, is assigned to ISO week 52 instead of ISO week 1. Expected behavior: According to user expectations, January 1st of any year should always be part of week 1, regardless of ISO 8601 standards. Root cause: The calculation of ISO week numbers strictly follows ISO 8601, where: Week 1 is defined as the first week with a Thursday in the new year. January 1st does not always fall into this definition. This results in January 1st, 2025, being part of ISO week 52 of the previous year (2024).
date count
0 2025-01-01 00:00:00+00:00 0.0
1 2025-01-02 00:00:00+00:00 0.0
2 2025-01-03 00:00:00+00:00 0.0
3 2025-01-04 00:00:00+00:00 0.0
4 2025-01-05 00:00:00+00:00 0.0
5 2025-01-06 00:00:00+00:00 0.0
6 2025-01-07 00:00:00+00:00 0.0
7 2025-01-08 00:00:00+00:00 0.0
8 2025-01-09 00:00:00+00:00 0.0
9 2025-01-10 00:00:00+00:00 5.0
10 2025-01-11 00:00:00+00:00 25.0
11 2025-01-12 00:00:00+00:00 6.0
12 2025-01-13 00:00:00+00:00 0.0
13 2025-01-14 00:00:00+00:00 0.0
14 2025-01-15 00:00:00+00:00 37.0
Problem 2: Week Ordering Across Year Boundaries I do not have a picture of this problem right now. Observed behavior: Week 52 of 2024 is displayed after week 1 of 2025 in visualizations.
Expected behavior: Week 52 of the previous year should be shown before week 1 of the new year for chronological consistency. Root cause: The sorting logic likely sorts by the ISO week number without considering the year. This leads to week 52 (from 2024) being displayed after week 1 (from 2025). Steps to Reproduce Use a dataset that includes dates around the new year, such as the last week of 2024 and the first week of 2025. Visualize the data using a time histogram grouped by ISO week numbers and days. Observe: January 1st, 2025, is assigned to ISO week 52. Week 52 of 2024 appears after week 1 of 2025 in the visualization.