Our weekly report templates print the week number with the date filter: %U (weeks start on Sunday) and %W (weeks start on Monday). For many dates the number is off by one compared with what strftime gives in Ruby, Python…
Our weekly report templates print the week number with the date filter: %U (weeks start on Sunday) and %W (weeks start on Monday). For many dates the number is off by one compared with what strftime gives in Ruby, Python and C, so reports are filed under the wrong week.
Render {{ d | date: "%U %W" }} with d set to each of these:
2021-01-03T12:00:00 (a Sunday)2007-01-01T12:00:00 (a Monday)2006-07-05T12:00:00 (a Wednesday)01 0000 0127 2701 0100 0026 26strftime: week 01 starts on the first Sunday of the year for %U, and on the first Monday of the year for %W. Days before that are in week 00.2021-01-01 gives 00 00 and 2021-01-04 gives 01 01.%j (day of the year) and %a are fine.Adapted from harttle/liquidjs (MIT).
Visible test command
TZ=UTC npx --no-install jest --ci --coverage=falseThe repository’s own tests. Run all tests includes them, and so does every submission.
Repository
week-number-date-formats-wrong
Changes under src/ are evaluated.