From 7fd4d953677a71598eb76edc57197af1055a35ca Mon Sep 17 00:00:00 2001 From: Nulo Date: Fri, 1 Apr 2022 18:46:21 -0300 Subject: [PATCH] Use now to parse since and until dates --- z/exportCmd.go | 5 +++-- z/listCmd.go | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/z/exportCmd.go b/z/exportCmd.go index 449db04..b8e8827 100644 --- a/z/exportCmd.go +++ b/z/exportCmd.go @@ -5,6 +5,7 @@ import ( "fmt" "time" "encoding/json" + "github.com/jinzhu/now" "github.com/spf13/cobra" ) @@ -48,7 +49,7 @@ var exportCmd = &cobra.Command{ var untilTime time.Time if since != "" { - sinceTime, err = time.Parse(time.RFC3339, since) + sinceTime, err = now.Parse(since) if err != nil { fmt.Printf("%s %+v\n", CharError, err) os.Exit(1) @@ -56,7 +57,7 @@ var exportCmd = &cobra.Command{ } if until != "" { - untilTime, err = time.Parse(time.RFC3339, until) + untilTime, err = now.Parse(until) if err != nil { fmt.Printf("%s %+v\n", CharError, err) os.Exit(1) diff --git a/z/listCmd.go b/z/listCmd.go index 9007026..1435cf3 100644 --- a/z/listCmd.go +++ b/z/listCmd.go @@ -5,6 +5,7 @@ import ( "os" "time" + "github.com/jinzhu/now" "github.com/shopspring/decimal" "github.com/spf13/cobra" ) @@ -31,7 +32,7 @@ var listCmd = &cobra.Command{ var untilTime time.Time if since != "" { - sinceTime, err = time.Parse(time.RFC3339, since) + sinceTime, err = now.Parse(since) if err != nil { fmt.Printf("%s %+v\n", CharError, err) os.Exit(1) @@ -39,7 +40,7 @@ var listCmd = &cobra.Command{ } if until != "" { - untilTime, err = time.Parse(time.RFC3339, until) + untilTime, err = now.Parse(until) if err != nil { fmt.Printf("%s %+v\n", CharError, err) os.Exit(1)