From 7d5bfee7950a90f237d87f6657a53be4a78d29d2 Mon Sep 17 00:00:00 2001 From: Dylan Ravel Date: Mon, 22 Dec 2025 23:06:28 -0700 Subject: [PATCH 1/2] Compare entry times with minute precision in edit command Updated the edit command to compare StartTime and EndTime fields with minute-level precision by truncating to the nearest minute. This prevents false positives when only sub-minute differences exist, aligning with the precision of parseDateTime. --- cmd/entries/edit.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/entries/edit.go b/cmd/entries/edit.go index 19509c9..d875c1a 100644 --- a/cmd/entries/edit.go +++ b/cmd/entries/edit.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "strings" + "time" "github.com/DylanDevelops/tmpo/internal/project" "github.com/DylanDevelops/tmpo/internal/storage" @@ -258,14 +259,21 @@ func EditCmd() *cobra.Command { hasChanges := false - if !selectedEntry.StartTime.Equal(editedEntry.StartTime) { + // Truncate to minute precision for comparison since parseDateTime only parses to the minute + selectedStartTrunc := selectedEntry.StartTime.Truncate(time.Minute) + editedStartTrunc := editedEntry.StartTime.Truncate(time.Minute) + + if !selectedStartTrunc.Equal(editedStartTrunc) { hasChanges = true oldStr := selectedEntry.StartTime.Format("01-02-2006 3:04 PM") newStr := editedEntry.StartTime.Format("01-02-2006 3:04 PM") fmt.Printf(" %s %s → %s\n", ui.Bold("Start time:"), ui.Muted(oldStr), newStr) } - if !selectedEntry.EndTime.Equal(*editedEntry.EndTime) { + selectedEndTrunc := selectedEntry.EndTime.Truncate(time.Minute) + editedEndTrunc := editedEntry.EndTime.Truncate(time.Minute) + + if !selectedEndTrunc.Equal(editedEndTrunc) { hasChanges = true oldStr := selectedEntry.EndTime.Format("01-02-2006 3:04 PM") newStr := editedEntry.EndTime.Format("01-02-2006 3:04 PM") From 5221697f1ee05e6faf32f96df774d8fbf4ee3cd2 Mon Sep 17 00:00:00 2001 From: Dylan Ravel Date: Mon, 22 Dec 2025 23:08:22 -0700 Subject: [PATCH 2/2] Update edit.go --- cmd/entries/edit.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/entries/edit.go b/cmd/entries/edit.go index d875c1a..3d10d72 100644 --- a/cmd/entries/edit.go +++ b/cmd/entries/edit.go @@ -259,7 +259,6 @@ func EditCmd() *cobra.Command { hasChanges := false - // Truncate to minute precision for comparison since parseDateTime only parses to the minute selectedStartTrunc := selectedEntry.StartTime.Truncate(time.Minute) editedStartTrunc := editedEntry.StartTime.Truncate(time.Minute)