From 1e9523c54994076b7711e0325329fd02b7594290 Mon Sep 17 00:00:00 2001 From: Eric Moynihan Date: Mon, 2 Nov 2020 15:26:57 +0000 Subject: [PATCH] Release 1.0.9 --- api/version.go | 2 +- graph/graph.go | 5 +++-- main.go | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/api/version.go b/api/version.go index 5bd1e8b..f697b68 100644 --- a/api/version.go +++ b/api/version.go @@ -1,4 +1,4 @@ package api // Version of stonks -const Version = "1.0.8" +const Version = "1.0.9" diff --git a/graph/graph.go b/graph/graph.go index e21180c..e858287 100644 --- a/graph/graph.go +++ b/graph/graph.go @@ -3,6 +3,7 @@ package graph import ( "fmt" "strings" + "time" "github.com/ericm/stonks/api" "github.com/shopspring/decimal" @@ -33,7 +34,7 @@ func borderHorizontal(out *string, width int) { } // GenerateGraph with ASCII graph with ANSI escapes -func GenerateGraph(chart *api.Chart, width int, height int, chartTheme ChartTheme) (string, error) { +func GenerateGraph(chart *api.Chart, width int, height int, chartTheme ChartTheme, timezone *time.Location) (string, error) { out := "┏" maxSize := len(strings.Split(chart.High.String(), ".")[0]) + 3 borderHorizontal(&out, width+maxSize+3) @@ -228,7 +229,7 @@ retryFooter: if chart.End.Unix()-chart.Start.Unix() > 86400 { format = dayFormat } - t := bar.Timestamp.Time().Format(format) + t := bar.Timestamp.Time().In(timezone).Format(format) if lastLen > 0 { for _i := 0; _i < diff-len(t); _i++ { footer += " " diff --git a/main.go b/main.go index ce4247e..f72dddf 100644 --- a/main.go +++ b/main.go @@ -149,7 +149,7 @@ func main() { fmt.Println(err.Error()) continue } - g, _ := graph.GenerateGraph(chart, *width, viper.GetInt("config.favourites_height"), chartTheme) + g, _ := graph.GenerateGraph(chart, *width, viper.GetInt("config.favourites_height"), chartTheme, time.Local) fmt.Print(g) } } @@ -165,7 +165,7 @@ func main() { fmt.Println(err.Error()) os.Exit(1) } - g, _ := graph.GenerateGraph(chart, *width, viper.GetInt("config.standalone_height"), chartTheme) + g, _ := graph.GenerateGraph(chart, *width, viper.GetInt("config.standalone_height"), chartTheme, time.Local) fmt.Print(g) } },