refactor(task): use dateutil for schedule parsing

Amolith created

Natural language dates now supported for --schedule flag.

Assisted-by: Claude Sonnet 4 via Crush

Change summary

cmd/task/add.go | 5 +++--
go.mod          | 2 +-
go.sum          | 2 ++
3 files changed, 6 insertions(+), 3 deletions(-)

Detailed changes

cmd/task/add.go 🔗

@@ -15,6 +15,7 @@ import (
 	"git.secluded.site/lune/internal/client"
 	"git.secluded.site/lune/internal/completion"
 	"git.secluded.site/lune/internal/config"
+	"git.secluded.site/lune/internal/dateutil"
 	"git.secluded.site/lune/internal/ui"
 	"github.com/spf13/cobra"
 )
@@ -198,9 +199,9 @@ func applySchedule(cmd *cobra.Command, builder *lunatask.TaskBuilder) error {
 		return nil
 	}
 
-	date, err := lunatask.ParseDate(schedule)
+	date, err := dateutil.Parse(schedule)
 	if err != nil {
-		return fmt.Errorf("parsing schedule date: %w", err)
+		return err
 	}
 
 	builder.ScheduledOn(date)

go.mod 🔗

@@ -11,6 +11,7 @@ require (
 	github.com/charmbracelet/lipgloss v1.1.0
 	github.com/google/uuid v1.6.0
 	github.com/klauspost/lctime v0.1.0
+	github.com/markusmobius/go-dateparser v1.2.4
 	github.com/spf13/cobra v1.10.2
 	github.com/zalando/go-keyring v0.2.6
 )
@@ -45,7 +46,6 @@ require (
 	github.com/jalaali/go-jalaali v0.0.0-20210801064154-80525e88d958 // indirect
 	github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
 	github.com/magefile/mage v1.14.0 // indirect
-	github.com/markusmobius/go-dateparser v1.2.4 // indirect
 	github.com/mattn/go-isatty v0.0.20 // indirect
 	github.com/mattn/go-localereader v0.0.1 // indirect
 	github.com/mattn/go-runewidth v0.0.19 // indirect

go.sum 🔗

@@ -133,6 +133,8 @@ github.com/tetratelabs/wazero v1.2.1 h1:J4X2hrGzJvt+wqltuvcSjHQ7ujQxA9gb6PeMs4ql
 github.com/tetratelabs/wazero v1.2.1/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ=
 github.com/wasilibs/go-re2 v1.3.0 h1:LFhBNzoStM3wMie6rN2slD1cuYH2CGiHpvNL3UtcsMw=
 github.com/wasilibs/go-re2 v1.3.0/go.mod h1:AafrCXVvGRJJOImMajgJ2M7rVmWyisVK7sFshbxnVrg=
+github.com/wasilibs/nottinygc v0.4.0 h1:h1TJMihMC4neN6Zq+WKpLxgd9xCFMw7O9ETLwY2exJQ=
+github.com/wasilibs/nottinygc v0.4.0/go.mod h1:oDcIotskuYNMpqMF23l7Z8uzD4TC0WXHK8jetlB3HIo=
 github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
 github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
 github.com/zalando/go-keyring v0.2.6 h1:r7Yc3+H+Ux0+M72zacZoItR3UDxeWfKTcabvkI8ua9s=