diff --git a/CHANGES.md b/CHANGES.md index 255b3d32f..be47d57d1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changes +## master + +* Print dates in local time + ## v1.2.0 * Update hcloud library to v1.2.0 fixing rate limit check diff --git a/image_describe.go b/image_describe.go index 8b9fc45fb..2045bbca2 100644 --- a/image_describe.go +++ b/image_describe.go @@ -41,7 +41,7 @@ func runImageDescribe(cli *CLI, cmd *cobra.Command, args []string) error { fmt.Printf("Image size:\t%s\n", na("")) } fmt.Printf("Disk size:\t%.0f GB\n", image.DiskSize) - fmt.Printf("Created:\t%s (%s)\n", image.Created, humanize.Time(image.Created)) + fmt.Printf("Created:\t%s (%s)\n", datetime(image.Created), humanize.Time(image.Created)) fmt.Printf("OS flavor:\t%s\n", image.OSFlavor) fmt.Printf("OS version:\t%s\n", na(image.OSVersion)) fmt.Printf("Rapid deploy:\t%s\n", yesno(image.RapidDeploy)) diff --git a/server_describe.go b/server_describe.go index 78dbb2092..90f8b4273 100644 --- a/server_describe.go +++ b/server_describe.go @@ -33,7 +33,7 @@ func runServerDescribe(cli *CLI, cmd *cobra.Command, args []string) error { fmt.Printf("ID:\t\t%d\n", server.ID) fmt.Printf("Name:\t\t%s\n", server.Name) fmt.Printf("Status:\t\t%s\n", server.Status) - fmt.Printf("Created:\t%s (%s)\n", server.Created, humanize.Time(server.Created)) + fmt.Printf("Created:\t%s (%s)\n", datetime(server.Created), humanize.Time(server.Created)) fmt.Printf("Server Type:\t%s (ID: %d)\n", server.ServerType.Name, server.ServerType.ID) fmt.Printf(" ID:\t\t%d\n", server.ServerType.ID) @@ -80,7 +80,7 @@ func runServerDescribe(cli *CLI, cmd *cobra.Command, args []string) error { fmt.Printf(" Image size:\t%s\n", na("")) } fmt.Printf(" Disk size:\t%.0f GB\n", image.DiskSize) - fmt.Printf(" Created:\t%s (%s)\n", image.Created, humanize.Time(image.Created)) + fmt.Printf(" Created:\t%s (%s)\n", datetime(image.Created), humanize.Time(image.Created)) fmt.Printf(" OS flavor:\t%s\n", image.OSFlavor) fmt.Printf(" OS version:\t%s\n", na(image.OSVersion)) fmt.Printf(" Rapid deploy:\t%s\n", yesno(image.RapidDeploy)) diff --git a/util.go b/util.go index bc8d06c7b..a52daef8e 100644 --- a/util.go +++ b/util.go @@ -22,6 +22,10 @@ func na(s string) string { return s } +func datetime(t time.Time) string { + return t.Local().Format(time.UnixDate) +} + func waitAction(ctx context.Context, client *hcloud.Client, action *hcloud.Action) (<-chan error, <-chan int) { errCh := make(chan error, 1) progressCh := make(chan int)