Files
PORTAL_COD2/src/back/portal/portal/timesrefresh.py
T
2024-03-25 10:26:06 +03:00

13 lines
355 B
Python

from datetime import datetime, timedelta
def time_until_end_of_day(dt=None):
if dt is None:
today = datetime.today()
current_weekday = today.weekday()
days_until_sunday = (6 - current_weekday) % 7
first_sunday = today + timedelta(days=days_until_sunday)
return ((first_sunday.date() - today.date()).days)