From 8324d9ab7930a3a38b136fb9c2d6e4185e39f220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C5=A0?= Date: Sun, 5 Mar 2023 11:03:21 +0100 Subject: [PATCH] Fix menu date parser Menu date format has changed for the first time in (at least) 2 years... Now, the 1st week of the month is the week that includes the 1st day in the month. --- API/gimvicurnik/updaters/menu.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/API/gimvicurnik/updaters/menu.py b/API/gimvicurnik/updaters/menu.py index 6ba8f49..cd86b46 100644 --- a/API/gimvicurnik/updaters/menu.py +++ b/API/gimvicurnik/updaters/menu.py @@ -149,9 +149,7 @@ def get_document_effective(self, document: DocumentInfo) -> datetime.date: # Get start of nth week of the month first = datetime.date(year, month, 1) - diff = -first.weekday() if month == 9 else 7 - first.weekday() - diff = diff if diff < 7 else 0 - new = first + datetime.timedelta(weeks=week - 1, days=diff) + new = first + datetime.timedelta(weeks=week - 1, days=-first.weekday()) return new