Module: Strava::Models::Mixins::StartDateLocal

Extended by:
ActiveSupport::Concern
Included in:
DetailedActivity, DetailedSegmentEffort, Lap, SummaryActivity, SummarySegmentEffort
Defined in:
lib/strava/models/mixins/start_date_local.rb

Overview

Provides local start date/time with timezone handling.

This mixin adds the start_date_local property and handles proper timezone conversion. The offset is calculated from the difference between start_date (UTC) and start_date_local, which correctly accounts for daylight saving time (unlike Strava's 'timezone' property, which only reflects the zone's standard GMT offset).

This is particularly important for activities that cross timezone boundaries or for displaying times in the athlete's local timezone.

Examples:

Using local start date

activity = client.activity(1234567890)
puts activity.start_date        # => 2024-01-15 14:30:00 UTC
puts activity.start_date_local  # => 2024-01-15 09:30:00 -0500