diff --git a/z/entry.go b/z/entry.go index 801240a..3aec902 100644 --- a/z/entry.go +++ b/z/entry.go @@ -47,7 +47,7 @@ func NewEntry( return Entry{}, err } - if newEntry.IsFinishedAfterBegan() == false { + if id == "" && newEntry.IsFinishedAfterBegan() == false { return Entry{}, errors.New("beginning time of tracking cannot be after finish time") } diff --git a/z/finishCmd.go b/z/finishCmd.go index 2cf7c42..e2dc744 100644 --- a/z/finishCmd.go +++ b/z/finishCmd.go @@ -81,6 +81,11 @@ var finishCmd = &cobra.Command{ } } + if runningEntry.IsFinishedAfterBegan() == false { + fmt.Printf("%s %+v\n", CharError, "beginning time of tracking cannot be after finish time") + os.Exit(1) + } + _, err = database.FinishEntry(user, runningEntry) if err != nil { fmt.Printf("%s %+v\n", CharError, err)