Spaces:
Running
Running
Daniel Amendoeira
commited on
Update tools.py
Browse files
tools.py
CHANGED
@@ -9,10 +9,11 @@ def day_of_week(_):
|
|
9 |
|
10 |
def days_until(date_str):
|
11 |
try:
|
12 |
-
future_date = datetime.datetime.strptime(date_str, "%Y-%m-%d")
|
13 |
-
today = datetime.
|
14 |
-
|
15 |
-
|
|
|
16 |
except Exception as e:
|
17 |
return f"Error parsing date: {str(e)}"
|
18 |
|
|
|
9 |
|
10 |
def days_until(date_str):
|
11 |
try:
|
12 |
+
future_date = datetime.datetime.strptime(date_str, "%Y-%m-%d").date()
|
13 |
+
today = datetime.date.today()
|
14 |
+
|
15 |
+
delta_days = (future_date - today).days
|
16 |
+
return f"{delta_days} days until {date_str}"
|
17 |
except Exception as e:
|
18 |
return f"Error parsing date: {str(e)}"
|
19 |
|