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):
|
if current_location and is_schengen_country(current_location):
|
||||||
# Currently in Schengen
|
# Currently in Schengen
|
||||||
if to_country and not is_schengen_country(to_country):
|
if to_country and not is_schengen_country(to_country):
|
||||||
# Exiting Schengen
|
# Exiting Schengen - use departure date
|
||||||
if entry_date:
|
if entry_date:
|
||||||
stays.append(
|
stays.append(
|
||||||
SchengenStay(
|
SchengenStay(
|
||||||
|
@ -156,8 +156,15 @@ def extract_schengen_stays_from_travel(
|
||||||
else:
|
else:
|
||||||
# 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
|
# Entering Schengen - use arrival date for long-haul flights
|
||||||
entry_date = travel_date
|
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
|
current_location = to_country
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue