Skip to content

Commit 9f1a028

Browse files
committed
fix date object comparison with string in instagram feed
1 parent 9c150d3 commit 9f1a028

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

backend/scraping/instagram_feed.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ def check_post_limit():
438438
first_occurrence = event_data.get("occurrences")[0]
439439
dtstart_utc = first_occurrence.get("start_utc")
440440
now = timezone.now()
441+
if isinstance(dtstart_utc, str):
442+
dtstart_utc = parser.parse(dtstart_utc)
443+
if timezone.is_naive(dtstart_utc):
444+
dtstart_utc = timezone.make_aware(dtstart_utc)
441445
if dtstart_utc and dtstart_utc < now:
442446
logger.info(
443447
f"[{post.shortcode}] [{post.owner_username}] Skipping event '{event_data.get('title')}' with past date {dtstart_utc}"

0 commit comments

Comments
 (0)