From dc6cd636b1efa97c5e893847bf16e637ce31d05e Mon Sep 17 00:00:00 2001 From: Dylan Ravel Date: Mon, 16 Feb 2026 13:54:47 -0800 Subject: [PATCH] Allow empty start date to default to today --- cmd/entries/manual.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cmd/entries/manual.go b/cmd/entries/manual.go index 26ebbdc..0cb2120 100644 --- a/cmd/entries/manual.go +++ b/cmd/entries/manual.go @@ -82,9 +82,18 @@ func ManualCmd() *cobra.Command { os.Exit(1) } + todayDate := time.Now().Format(dateFormatLayout) + startDatePrompt := promptui.Prompt{ - Label: fmt.Sprintf("Start date (%s)", dateFormatDisplay), - Validate: func(input string) error { return validateDate(input, dateFormatLayout, dateFormatDisplay) }, + Label: fmt.Sprintf("Start date (%s): (%s)", dateFormatDisplay, todayDate), + AllowEdit: true, + Validate: func(input string) error { + if strings.TrimSpace(input) == "" { + return nil + } + + return validateDate(input, dateFormatLayout, dateFormatDisplay) + }, } startDateInput, err := startDatePrompt.Run() @@ -93,6 +102,11 @@ func ManualCmd() *cobra.Command { os.Exit(1) } + startDateInput = strings.TrimSpace(startDateInput) + if startDateInput == "" { + startDateInput = todayDate + } + startTimePrompt := promptui.Prompt{ Label: "Start time (e.g., 9:30 AM or 14:30)", Validate: validateTime,