From 791759b322d01d0ba4921d21feb7c2cd9da3cfcd Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Tue, 15 Jul 2025 15:36:03 +0200 Subject: [PATCH] Fix Schengen calculation bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- agenda/schengen.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/agenda/schengen.py b/agenda/schengen.py index 8e8fc3a..53debf8 100644 --- a/agenda/schengen.py +++ b/agenda/schengen.py @@ -157,14 +157,12 @@ def extract_schengen_stays_from_travel( # Currently outside Schengen if to_country and is_schengen_country(to_country): # Entering Schengen - use arrival date for long-haul flights - entry_travel_date = travel_date - if item.get("arrive"): - arrive_date = item.get("arrive") - if isinstance(arrive_date, datetime): - arrive_date = arrive_date.date() - elif isinstance(arrive_date, date): - entry_travel_date = arrive_date - entry_date = entry_travel_date + arrive_date = item.get("arrive") + assert arrive_date + if isinstance(arrive_date, datetime): + arrive_date = arrive_date.date() + assert isinstance(arrive_date, date) + entry_date = arrive_date current_location = to_country