Skip to content

Conversation

@tobiaszwaszak
Copy link
Contributor

This is probably an issue on strava site, but it's easier to handle it on gem side.

When I try to get club events, I have an error:

no time information in "" (ArgumentError)

raise ArgumentError, "no time information in #{date.inspect}"

Looks like there is no information about created_at

This PR handles that issue

@dangerpr-bot
Copy link

dangerpr-bot commented May 30, 2025

1 Error
🚫 One of the lines below found in CHANGELOG.md doesn't match the expected format. Please make it look like the other lines, pay attention to version numbers, periods, spaces and date formats.
* [#89]https://github.com/dblock/strava-ruby-client/pull/89: Fix for time parsing in club events - [@tobiaszwaszak](https://github.com/tobiaszwaszak).

Generated by 🚫 Danger

@tobiaszwaszak tobiaszwaszak force-pushed the time-parse-error-for-club-events branch from 58456d1 to 9b6e411 Compare May 30, 2025 17:47
Copy link
Owner

@dblock dblock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is Strava actually returning? If it's nil, then handle this with an if.

property 'created_at', transform_with: ->(v) { Time.parse(v) if v }

@@ -1,5 +1,6 @@
### 2.3.0 (Next)

* [#89]https://github.com/dblock/strava-ruby-client/pull/89: Fix for time parsing in club events - [@tobiaszwaszak](https://github.com/tobiaszwaszak).
Copy link
Owner

@dblock dblock May 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* [#89]https://github.com/dblock/strava-ruby-client/pull/89: Fix for time parsing in club events - [@tobiaszwaszak](https://github.com/tobiaszwaszak).
* [#89](https://github.com/dblock/strava-ruby-client/pull/89): Fix `nil` time parsing in club events - [@tobiaszwaszak](https://github.com/tobiaszwaszak).

@tobiaszwaszak
Copy link
Contributor Author

What is Strava actually returning? If it's nil, then handle this with an if.

property 'created_at', transform_with: ->(v) { Time.parse(v) if v }

yes its nil

Copy link
Owner

@dblock dblock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix doesn't seem quite right. Iterate till CI passes too please, CHANGELOG needs an update.

property 'organizing_athlete', transform_with: ->(oa) { Strava::Models::Athlete.new(oa) }
property 'activity_type'
property 'created_at', transform_with: ->(v) { Time.parse(v) }
property 'created_at', transform_with: ->(v) { Time.parse(v) if v['created_at'] }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can't be right because v is the time, not v['created_at']. Add a test when the club activity has a created_at time and that test should pass.

@dblock
Copy link
Owner

dblock commented Oct 18, 2025

Fixed in #95.

@dblock dblock closed this Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants