mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-08 11:17:29 +00:00
chatgpt week commencing calcualtor
This commit is contained in:
parent
2fe9cf3d00
commit
5e4790e723
1 changed files with 4 additions and 7 deletions
|
|
@ -11,13 +11,10 @@ from etl.validator.validator import DomnaSharePointValidator
|
|||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
def previous_monday(date):
|
||||
# If it's Monday, return the same date
|
||||
if date.weekday() == 0:
|
||||
return date.strftime("%d%m%y")
|
||||
# Otherwise, find the previous Monday
|
||||
previous_monday = date - timedelta(days=date.weekday())
|
||||
return f"W.C. {previous_monday.strftime('%d.%m.%Y')}"
|
||||
def previous_monday():
|
||||
today = datetime.today()
|
||||
last_monday = today - timedelta(days=today.weekday() + 7) # Go back to last week's Monday
|
||||
return f"W.C. {last_monday.strftime('%d.%m.%Y')}"
|
||||
|
||||
WEEK_COMMENCING = os.getenv("WEEK_COMMENCING", previous_monday())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue