Fix Schengen calculation bug

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Edward Betts 2025-07-15 15:36:03 +02:00
parent 338d6ea067
commit 791759b322

View file

@ -157,14 +157,12 @@ def extract_schengen_stays_from_travel(
# Currently outside Schengen # Currently outside Schengen
if to_country and is_schengen_country(to_country): if to_country and is_schengen_country(to_country):
# Entering Schengen - use arrival date for long-haul flights # Entering Schengen - use arrival date for long-haul flights
entry_travel_date = travel_date arrive_date = item.get("arrive")
if item.get("arrive"): assert arrive_date
arrive_date = item.get("arrive") if isinstance(arrive_date, datetime):
if isinstance(arrive_date, datetime): arrive_date = arrive_date.date()
arrive_date = arrive_date.date() assert isinstance(arrive_date, date)
elif isinstance(arrive_date, date): entry_date = arrive_date
entry_travel_date = arrive_date
entry_date = entry_travel_date
current_location = to_country current_location = to_country