Use now to parse since and until dates

This commit is contained in:
Cat /dev/Nulo 2022-04-01 18:46:21 -03:00
parent c07a40a318
commit 7fd4d95367
2 changed files with 6 additions and 4 deletions

View file

@ -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)

View file

@ -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)