dblock / slack-strava

(Re)Post Strava activities to Slack
https://slava.playplay.io
MIT License
37 stars 6 forks source link

Activity start time not showing in correct timezone #58

Closed dblock closed 5 years ago

dblock commented 5 years ago
=> #<UserActivity _id: 5bff2079faf6fa00ec366f9b, created_at: 2018-11-28 23:10:49 UTC, updated_at: 2018-11-28 23:10:50 UTC, strava_id: "1990206625", name: "Morning Run", distance: 11771.3, description: nil, moving_time: 4191.0, elapsed_time: 4191.0, average_speed: 2.809, bragged_at: 2018-11-28 23:10:50 UTC, total_elevation_gain: 109.1, private: false, type: "Run", _type: "UserActivity", start_date: 2018-11-28 21:52:15 UTC, start_date_local: 2018-11-29 04:52:15 UTC, user_id: BSON::ObjectId('5bc9792bdfe37500ec41632b')>

https://www.strava.com/activities/1990206625

Shows as Thursday, November 29, 4:52 AM. The strava_activity['timezone'] is "(GMT+07:00) Asia/Bangkok", so:

t = DateTime.parse(strava_activity['start_date_local'])
=> Thu, 29 Nov 2018 04:52:15 +0000

t.in_time_zone('Asia/Bangkok')
=> Thu, 29 Nov 2018 11:52:15 +07 +07:00
dblock commented 5 years ago

Not a bug. This guy actually runs at 4:52AM, and start_date_local is correct.