Fix Schengen time tracking to use arrival date for long-haul flights
Use arrival date instead of departure date when entering Schengen countries to correctly handle overnight flights that cross date boundaries. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8363a581c7
commit
338d6ea067
|
@ -142,7 +142,7 @@ def extract_schengen_stays_from_travel(
|
|||
if current_location and is_schengen_country(current_location):
|
||||
# Currently in Schengen
|
||||
if to_country and not is_schengen_country(to_country):
|
||||
# Exiting Schengen
|
||||
# Exiting Schengen - use departure date
|
||||
if entry_date:
|
||||
stays.append(
|
||||
SchengenStay(
|
||||
|
@ -156,8 +156,15 @@ def extract_schengen_stays_from_travel(
|
|||
else:
|
||||
# Currently outside Schengen
|
||||
if to_country and is_schengen_country(to_country):
|
||||
# Entering Schengen
|
||||
entry_date = travel_date
|
||||
# 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
|
||||
|
||||
current_location = to_country
|
||||
|
||||
|
|
Loading…
Reference in a new issue