Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/bodyweights.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func loadBodyweightEntries(sinceFlag string) ([]bodyweightEntry, error) {
if err != nil {
continue
}
date = date.Local()
if !since.IsZero() && date.Before(since) {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func buildSummaries(posts []Post) []ExerciseSummary {
for _, p := range posts {
bw, _ := strconv.ParseFloat(strings.TrimSpace(p.Bodyweight), 64)
t, _ := time.Parse(time.RFC3339Nano, p.StartedAt)
date := t.Format("2006-01-02")
date := t.Local().Format("2006-01-02")

for _, e := range p.ExerciseData {
ss := sessionStats(e, bw)
Expand Down
8 changes: 4 additions & 4 deletions cmd/workouts.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var listCmd = &cobra.Command{

func parseSince(s string) (time.Time, error) {
// Try absolute date first
if t, err := time.Parse("2006-01-02", s); err == nil {
if t, err := time.ParseInLocation("2006-01-02", s, time.Local); err == nil {
return t, nil
}
// Try relative: e.g. 30d, 4w, 6m, 1y
Expand Down Expand Up @@ -137,7 +137,7 @@ var showCmd = &cobra.Command{
if err != nil {
continue
}
if t.Format("2006-01-02") == target.Format("2006-01-02") {
if t.Local().Format("2006-01-02") == target.Format("2006-01-02") {
matched = append(matched, p)
}
}
Expand All @@ -162,7 +162,7 @@ func parseDate(s string) (time.Time, error) {
case "yesterday":
return now.AddDate(0, 0, -1), nil
}
if t, err := time.Parse("2006-01-02", s); err == nil {
if t, err := time.ParseInLocation("2006-01-02", s, time.Local); err == nil {
return t, nil
}
return time.Time{}, fmt.Errorf("invalid date: %q (use YYYY-MM-DD, today, or yesterday)", s)
Expand Down Expand Up @@ -223,7 +223,7 @@ func printFitdown(posts []Post) error {
if err != nil {
fmt.Printf("Workout %s\n", post.StartedAt)
} else {
fmt.Printf("Workout %s\n", t.Format("January 2, 2006"))
fmt.Printf("Workout %s\n", t.Local().Format("January 2, 2006"))
}

if post.SessionNotes != "" {
Expand Down
Loading