Spaces:
Running on Zero
Running on Zero
Commit ·
d40641a
1
Parent(s): 8b7ed32
fix(daily): normalize target_date in rotate_daily_content_at_midnight
Browse files
app/services/daily_translation_pipeline.py
CHANGED
|
@@ -961,6 +961,10 @@ async def rotate_daily_content_at_midnight(
|
|
| 961 |
"""
|
| 962 |
if target_date is None:
|
| 963 |
target_date = datetime.datetime.utcnow().date()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 964 |
today_str = target_date.strftime("%Y-%m-%d")
|
| 965 |
now = datetime.datetime.utcnow()
|
| 966 |
|
|
|
|
| 961 |
"""
|
| 962 |
if target_date is None:
|
| 963 |
target_date = datetime.datetime.utcnow().date()
|
| 964 |
+
elif isinstance(target_date, datetime.datetime):
|
| 965 |
+
target_date = target_date.date()
|
| 966 |
+
elif isinstance(target_date, str):
|
| 967 |
+
target_date = datetime.date.fromisoformat(target_date.split("T")[0])
|
| 968 |
today_str = target_date.strftime("%Y-%m-%d")
|
| 969 |
now = datetime.datetime.utcnow()
|
| 970 |
|