Skip to content

fix: convert workout timestamps to local timezone - #8

Open
fencerJP wants to merge 1 commit into
obay:mainfrom
fencerJP:fix/timestamps-local-tz
Open

fix: convert workout timestamps to local timezone#8
fencerJP wants to merge 1 commit into
obay:mainfrom
fencerJP:fix/timestamps-local-tz

Conversation

@fencerJP

Copy link
Copy Markdown

Problem

Hevy API returns start_time as UTC (Z-suffixed ISO-8601, e.g. "2026-08-31T09:57:17Z"). Go's time.Parse sets Location = UTC for these strings, so every .Format() call outputs UTC — resulting in workout times displayed 9 hours behind for JST users.

Fix

Added .Local() before each .Format() call on w.StartTime to convert to the host system's timezone.

Files changed

File Line Change
cmd/workout/list.go 123 Date column in workout list
cmd/workout/get.go 107 Full datetime in workout get <id>
cmd/workout/get.go 61 TUI picker subtitle (interactive workout selection)

Testing notes

  • .Local() is a no-op if the host timezone is UTC — safe for all users.
  • No Go compiler available on my test machine, but the change is trivially correct: .Local() returns a time.Time with the host's location, then .Format() uses that location.

Hevy API returns start_time as UTC (Z-suffixed ISO-8601), which Go parses
with Location=UTC. Format() was outputting them as-is, causing every
workout timestamp to display 9 hours behind for JST users.

Added .Local() calls to convert to the host's timezone before formatting.

Affects:
- workout list Date column
- workout get <id> Date field
- TUI picker subtitle
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0f52bed2-754a-4186-89d3-ac299a7caf0c


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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