Skip to content

Fix getLocalTimestamp#82

Open
CuberL wants to merge 1 commit into
Pythe1337N:masterfrom
CuberL:fix-get-local-timestamp
Open

Fix getLocalTimestamp#82
CuberL wants to merge 1 commit into
Pythe1337N:masterfrom
CuberL:fix-get-local-timestamp

Conversation

@CuberL

@CuberL CuberL commented Dec 10, 2024

Copy link
Copy Markdown

Hi, I noticed that the implementation of the getLocalTimestamp method used in updateWeight seems problematic. As I understand it, this method is intended to generate an ISO format event string for a specified timezone. Taking America/Los_Angeles (GMT-8) as an example, for the UTC time 2024-12-10T18:00:00.000Z, the expected result should be 2024-12-10T10:00:00.000. However, the method currently returns 2024-12-09T18:00:00.000. As a result, the recorded date in Garmin Connect is December 9th, and the time is incorrect.

To address this, I have reimplemented the method. For the same case, the result will now be 2024-12-10T10:00:00.000.

The sv language was chosen because Swedish uses ISO strings as its time representation format.

GeorgeTG added a commit to GeorgeTG/garmin-connect that referenced this pull request Apr 12, 2026
- ActivityType.Running: 'street_running' → 'running' (was using the
  sub-type value instead of the parent type key, causing getActivities
  with ActivityType.Running to return wrong results)
- getLocalTimestamp: replace double new Date() round-trip with
  toLocaleDateString/toLocaleTimeString('sv') approach which correctly
  applies the timezone without lossy locale string re-parsing
  (fixes updateWeight logging entries at wrong timestamps)

Fixes upstream issues Pythe1337N#79 and Pythe1337N#82

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant