Skip to content

Commit

Permalink
FIX: use local tz timestamps for api path (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
theOehrly committed Nov 17, 2023
1 parent 7f0153d commit b0bd95e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fastf1/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,10 +1027,17 @@ def __init__(self, event, session_name, f1_api_support=False):
telemetry data are available."""
self.date = self.event.get_session_date(session_name, utc=True)
"""pandas.Datetime: Date at which this session took place."""

try:
_api_date = self.event.get_session_date(session_name, utc=False)
except ValueError:
# not all backends provide local timestamps, use UTC then which
# works in almost all cases
_api_date = self.date
self.api_path = api.make_path(
self.event['EventName'],
self.event['EventDate'].strftime('%Y-%m-%d'),
self.name, self.date.strftime('%Y-%m-%d')
self.name, _api_date.strftime('%Y-%m-%d')
)
"""str: API base path for this session"""

Expand Down

0 comments on commit b0bd95e

Please sign in to comment.