From c5cb76a73183a8a8dfd61c60cb5cfce7ca7f990d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20H=C3=A5rek=20Andreassen?= <tim@harek.no> Date: Thu, 3 Oct 2024 22:48:50 +0200 Subject: [PATCH] chore: Better times MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tim Hårek Andreassen <tim@harek.no> --- cmd/forecast.go | 3 +-- cmd/now.go | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/forecast.go b/cmd/forecast.go index f268578..27d79ad 100644 --- a/cmd/forecast.go +++ b/cmd/forecast.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "os" - "time" "git.sr.ht/~timharek/yr/cmd/flags" "git.sr.ht/~timharek/yr/cmd/internal/ui/table" @@ -83,7 +82,7 @@ func forecast(cmd *cobra.Command, args []string) { itemTime = item.Time } t.Row( - itemTime.Format(time.DateTime), + itemTime.Format("Mon, 2 Jan 15:04"), fmt.Sprintf("%.1f °C", item.Temperature), fmt.Sprintf("%.1f mm", item.Percipitation), fmt.Sprintf("%.1f m/s %s", item.Wind.Speed, item.Wind.DirectionToString()), diff --git a/cmd/now.go b/cmd/now.go index 9cbb298..bbe0caf 100644 --- a/cmd/now.go +++ b/cmd/now.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "os" - "time" "git.sr.ht/~timharek/yr/cmd/flags" "git.sr.ht/~timharek/yr/internal/nominatim" @@ -77,14 +76,13 @@ func now(cmd *cobra.Command, args []string) { itemTime = n.Time } fmt.Printf( - `%s now: - %s + `%s %s: Temperature: %.1f °C Rain: %.1f mm Wind: %.1f m/s from %s `, n.Location, - itemTime.Format(time.DateTime), + itemTime.Format("Monday 2 Jan 15:04"), n.Temperature, n.Percipitation, n.Wind.Speed,