Skip to content

Commit 22c6dda

Browse files
thcyronthetechnick
authored andcommitted
Print dates in local time (#84)
1 parent 3418773 commit 22c6dda

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes
22

3+
## master
4+
5+
* Print dates in local time
6+
37
## v1.2.0
48

59
* Update hcloud library to v1.2.0 fixing rate limit check

image_describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func runImageDescribe(cli *CLI, cmd *cobra.Command, args []string) error {
4141
fmt.Printf("Image size:\t%s\n", na(""))
4242
}
4343
fmt.Printf("Disk size:\t%.0f GB\n", image.DiskSize)
44-
fmt.Printf("Created:\t%s (%s)\n", image.Created, humanize.Time(image.Created))
44+
fmt.Printf("Created:\t%s (%s)\n", datetime(image.Created), humanize.Time(image.Created))
4545
fmt.Printf("OS flavor:\t%s\n", image.OSFlavor)
4646
fmt.Printf("OS version:\t%s\n", na(image.OSVersion))
4747
fmt.Printf("Rapid deploy:\t%s\n", yesno(image.RapidDeploy))

server_describe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func runServerDescribe(cli *CLI, cmd *cobra.Command, args []string) error {
3333
fmt.Printf("ID:\t\t%d\n", server.ID)
3434
fmt.Printf("Name:\t\t%s\n", server.Name)
3535
fmt.Printf("Status:\t\t%s\n", server.Status)
36-
fmt.Printf("Created:\t%s (%s)\n", server.Created, humanize.Time(server.Created))
36+
fmt.Printf("Created:\t%s (%s)\n", datetime(server.Created), humanize.Time(server.Created))
3737

3838
fmt.Printf("Server Type:\t%s (ID: %d)\n", server.ServerType.Name, server.ServerType.ID)
3939
fmt.Printf(" ID:\t\t%d\n", server.ServerType.ID)
@@ -80,7 +80,7 @@ func runServerDescribe(cli *CLI, cmd *cobra.Command, args []string) error {
8080
fmt.Printf(" Image size:\t%s\n", na(""))
8181
}
8282
fmt.Printf(" Disk size:\t%.0f GB\n", image.DiskSize)
83-
fmt.Printf(" Created:\t%s (%s)\n", image.Created, humanize.Time(image.Created))
83+
fmt.Printf(" Created:\t%s (%s)\n", datetime(image.Created), humanize.Time(image.Created))
8484
fmt.Printf(" OS flavor:\t%s\n", image.OSFlavor)
8585
fmt.Printf(" OS version:\t%s\n", na(image.OSVersion))
8686
fmt.Printf(" Rapid deploy:\t%s\n", yesno(image.RapidDeploy))

util.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ func na(s string) string {
2222
return s
2323
}
2424

25+
func datetime(t time.Time) string {
26+
return t.Local().Format(time.UnixDate)
27+
}
28+
2529
func waitAction(ctx context.Context, client *hcloud.Client, action *hcloud.Action) (<-chan error, <-chan int) {
2630
errCh := make(chan error, 1)
2731
progressCh := make(chan int)

0 commit comments

Comments
 (0)