Skip to content

Commit

Permalink
Merge pull request #26 from catdevnull/master
Browse files Browse the repository at this point in the history
Use now to parse since and until dates
  • Loading branch information
mrusme authored Sep 30, 2022
2 parents 6dbfe52 + 83790d0 commit 27569af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions z/exportCmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"time"
"encoding/json"
"github.com/jinzhu/now"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -48,15 +49,15 @@ 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)
}
}

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)
Expand Down
5 changes: 3 additions & 2 deletions z/listCmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"time"

"github.com/jinzhu/now"
"github.com/shopspring/decimal"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -32,15 +33,15 @@ 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)
}
}

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)
Expand Down

0 comments on commit 27569af

Please sign in to comment.