Calendar and report: weeks start on Sunday in Greek, Bulgarian, Estonian, Irish, Slovene and five more #569

Closed
opened 2026-10-01 10:47:43 +00:00 by tiagoagueda · 0 comments
Owner

Found on 2026-09-29 in a read-only review of postulo at 95348908d, reading how the calendar and the report find the first day of a week and checking FIRST_DAY_OF_WEEK under every offered language.

Checked again on 2026-10-01 against main at 0a5cad587: still present. The code is now at applications/agenda.py:445-449 (month_range), applications/agenda.py:476-483 (week_days) and applications/agenda.py:629 (build); week_start, the settings and config/formats/ are where they were.

week_start() takes FIRST_DAY_OF_WEEK from the reader's locale, and the calendar's month and week views, the report's "last n weeks" period and its weekly cadence all follow it. For ten European languages whose countries start the week on Monday, that lookup answers Sunday, so a Greek or Slovene reader's calendar starts every row on Sunday and their report counts Sunday-to-Saturday weeks. #43 and #118 said the first day of the week would be checked for each language; for these it was not.

  • Where: applications/reports.py:66-77 (week_start), used by weeks_period (reports.py:165-173), _cadence (reports.py:302), month_range (applications/agenda.py:373-377), week_days (agenda.py:403-411) and build (agenda.py:551); config/settings/base.py:480-492, whose British fallbacks leave FIRST_DAY_OF_WEEK at Django's global default of 0; config/formats/ holds only en_GB.
  • What happens: Django's el and sl modules set FIRST_DAY_OF_WEEK = 0; bg, bs, et, ga, is and sq leave it commented out, so the global default 0 answers; hy and lb have no format module at all. Checked under translation.override for all 69 offered languages: those ten answer 0. A Greek reader opening Calendar for October 2026 gets a grid beginning Sunday 27 September under the column Κυρ; asking the report for the last four weeks on Wednesday 30 September gives 6 September (a Sunday) to 3 October. German and British English readers get Monday 28 September and 7 September.
  • Why it matters: the calendar reads wrongly for these readers every day, and the report — a document handed to an employment office — groups applications into weeks that are not the reader's weeks.
  • Fix: add config/formats/<locale>/formats.py with FIRST_DAY_OF_WEEK = 1 for bg, bs, el, et, ga, hy, is, lb, sl and sq; FORMAT_MODULE_PATH already consults them before Django's own. Do not set FIRST_DAY_OF_WEEK = 1 in settings as a blanket fallback: it would also move mt (Malta starts on Sunday in CLDR) and the African languages without a module, several of which also start on Sunday (South Africa, Ethiopia, Kenya); those belong to #70's per-language check. pt-pt and pt-br answer Sunday, which CLDR agrees with for both Portugal and Brazil.

Done when

  • A test in tests/test_reports.py pins FIRST_DAY_OF_WEEK for every language in settings.LANGUAGES against an explicit table, and fails today for the ten above.
  • A test in tests/test_calendar.py builds October 2026 under el and asserts the grid starts on Monday 28 September.

Related to #43 and #118 (closed), which promised the first day of the week would be checked per language, and to #70 (open), which holds the same check for the African languages.

Found on 2026-09-29 in a read-only review of postulo at 95348908d, reading how the calendar and the report find the first day of a week and checking `FIRST_DAY_OF_WEEK` under every offered language. Checked again on 2026-10-01 against `main` at `0a5cad587`: still present. The code is now at `applications/agenda.py:445-449` (`month_range`), `applications/agenda.py:476-483` (`week_days`) and `applications/agenda.py:629` (`build`); `week_start`, the settings and `config/formats/` are where they were. `week_start()` takes `FIRST_DAY_OF_WEEK` from the reader's locale, and the calendar's month and week views, the report's "last n weeks" period and its weekly cadence all follow it. For ten European languages whose countries start the week on Monday, that lookup answers Sunday, so a Greek or Slovene reader's calendar starts every row on Sunday and their report counts Sunday-to-Saturday weeks. #43 and #118 said the first day of the week would be checked for each language; for these it was not. - **Where:** `applications/reports.py:66-77` (`week_start`), used by `weeks_period` (`reports.py:165-173`), `_cadence` (`reports.py:302`), `month_range` (`applications/agenda.py:373-377`), `week_days` (`agenda.py:403-411`) and `build` (`agenda.py:551`); `config/settings/base.py:480-492`, whose British fallbacks leave `FIRST_DAY_OF_WEEK` at Django's global default of 0; `config/formats/` holds only `en_GB`. - **What happens:** Django's `el` and `sl` modules set `FIRST_DAY_OF_WEEK = 0`; `bg`, `bs`, `et`, `ga`, `is` and `sq` leave it commented out, so the global default 0 answers; `hy` and `lb` have no format module at all. Checked under `translation.override` for all 69 offered languages: those ten answer 0. A Greek reader opening *Calendar* for October 2026 gets a grid beginning Sunday 27 September under the column Κυρ; asking the report for the last four weeks on Wednesday 30 September gives 6 September (a Sunday) to 3 October. German and British English readers get Monday 28 September and 7 September. - **Why it matters:** the calendar reads wrongly for these readers every day, and the report — a document handed to an employment office — groups applications into weeks that are not the reader's weeks. - **Fix:** add `config/formats/<locale>/formats.py` with `FIRST_DAY_OF_WEEK = 1` for `bg`, `bs`, `el`, `et`, `ga`, `hy`, `is`, `lb`, `sl` and `sq`; `FORMAT_MODULE_PATH` already consults them before Django's own. Do not set `FIRST_DAY_OF_WEEK = 1` in settings as a blanket fallback: it would also move `mt` (Malta starts on Sunday in CLDR) and the African languages without a module, several of which also start on Sunday (South Africa, Ethiopia, Kenya); those belong to #70's per-language check. `pt-pt` and `pt-br` answer Sunday, which CLDR agrees with for both Portugal and Brazil. ## Done when - A test in `tests/test_reports.py` pins `FIRST_DAY_OF_WEEK` for every language in `settings.LANGUAGES` against an explicit table, and fails today for the ten above. - A test in `tests/test_calendar.py` builds October 2026 under `el` and asserts the grid starts on Monday 28 September. Related to #43 and #118 (closed), which promised the first day of the week would be checked per language, and to #70 (open), which holds the same check for the African languages.
tiagoagueda added this to the 0.5.0 milestone 2026-10-01 10:47:43 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo#569
No description provided.