bugfixing

This commit is contained in:
MuslemRahimi 2024-09-22 16:09:37 +02:00
parent b3e57ccbc9
commit 00d999379a

View File

@ -81,11 +81,10 @@ def remove_duplicates(elements):
def weekday(): def weekday():
today = datetime.today() today = datetime.today()
one_day = timedelta(1) yesterday = today - timedelta(1)
yesterday = today - one_day
while yesterday.weekday() >= 5: # 5 = Saturday, 6 = Sunday while yesterday.weekday() >= 5: # 5 = Saturday, 6 = Sunday
yesterday -= one_day yesterday -= timedelta(2)
return yesterday.strftime('%Y-%m-%d') return yesterday.strftime('%Y-%m-%d')
@ -94,6 +93,8 @@ today = datetime.today().strftime('%Y-%m-%d')
tomorrow = (datetime.today() + timedelta(1)) tomorrow = (datetime.today() + timedelta(1))
yesterday = weekday() yesterday = weekday()
print(yesterday, today)
if tomorrow.weekday() >= 5: # 5 = Saturday, 6 = Sunday if tomorrow.weekday() >= 5: # 5 = Saturday, 6 = Sunday
tomorrow = tomorrow + timedelta(days=(7 - tomorrow.weekday())) tomorrow = tomorrow + timedelta(days=(7 - tomorrow.weekday()))