Skip to content

Commit 609ebb2

Browse files
committed
fix datetime handling in extract_events_from_caption
1 parent c5d9ed4 commit 609ebb2

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

backend/services/openai_service.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,7 @@ def extract_events_from_caption(
114114
current_date = now.strftime("%Y-%m-%d")
115115
current_day_of_week = now.strftime("%A")
116116

117-
# Use post creation time if provided, else current time
118-
if post_created_at and isinstance(post_created_at, datetime):
119-
post_created_at_str = post_created_at.isoformat()
120-
else:
121-
post_created_at_str = ""
122-
context_datetime = post_created_at_str if post_created_at_str else now
117+
context_datetime = post_created_at if isinstance(post_created_at, datetime) else now
123118
context_datetime = pytz_timezone("America/Toronto").localize(
124119
context_datetime.replace(tzinfo=None)
125120
)

0 commit comments

Comments
 (0)