docs(meals): clarify week-key dual-read is same-instant (PLAT-134)

This commit is contained in:
Adam Moussa 2026-09-01 19:56:07 -04:00
parent 216860b82c
commit 0566722e96
No known key found for this signature in database
2 changed files with 7 additions and 0 deletions

View file

@ -24,6 +24,12 @@ def week_id_iso(dt: datetime) -> str:
def candidate_week_ids(dt: datetime) -> tuple[str, ...]:
"""Return U-week then ISO encodings of the same instant.
Dual-read does not advance the calendar week. ``%Y-W%U`` and ``%G-W%V``
are two strftime renderings of ``dt``. Example: 2026-01-01 encodes as
("2026-W00", "2026-W01"), not as "this week" then "next week".
"""
u_week = week_id_ustrftime(dt)
iso_week = week_id_iso(dt)
if u_week == iso_week:

View file

@ -24,6 +24,7 @@ def test_ustrftime_and_iso_differ_on_new_year():
def test_candidate_week_ids_u_week_first_then_iso():
# 2026-01-01: same instant encoded two ways, not a next-week lookup.
assert candidate_week_ids(MISMATCH_DT) == ("2026-W00", "2026-W01")