diff --git a/internal/cmd/server/create.go b/internal/cmd/server/create.go index 9e08c56f..3569a51c 100644 --- a/internal/cmd/server/create.go +++ b/internal/cmd/server/create.go @@ -10,6 +10,7 @@ import ( "net/textproto" "os" "strings" + "time" "github.com/hetznercloud/cli/internal/cmd/base" "github.com/hetznercloud/cli/internal/cmd/cmpl" @@ -242,9 +243,9 @@ func createOptsFromFlags( if !image.Deprecated.IsZero() { if allowDeprecatedImage { - fmt.Printf("Attention: image %s is deprecated. It will continue to be available until %s.\n", image.Name, image.Deprecated.AddDate(0, 3, 0).Format("2006-01-02")) + fmt.Printf("Attention: image %s is deprecated. It will continue to be available until %s.\n", image.Name, image.Deprecated.AddDate(0, 3, 0).Format(time.DateOnly)) } else { - err = fmt.Errorf("image %s is deprecated, please use --allow-deprecated-image to create a server with this image. It will continue to be available until %s", image.Name, image.Deprecated.AddDate(0, 3, 0).Format("2006-01-02")) + err = fmt.Errorf("image %s is deprecated, please use --allow-deprecated-image to create a server with this image. It will continue to be available until %s", image.Name, image.Deprecated.AddDate(0, 3, 0).Format(time.DateOnly)) return } } diff --git a/internal/cmd/server/rebuild.go b/internal/cmd/server/rebuild.go index 0b6e0892..ef8d1eee 100644 --- a/internal/cmd/server/rebuild.go +++ b/internal/cmd/server/rebuild.go @@ -3,6 +3,7 @@ package server import ( "context" "fmt" + "time" "github.com/hetznercloud/cli/internal/cmd/base" "github.com/hetznercloud/cli/internal/cmd/cmpl" @@ -54,9 +55,9 @@ var RebuildCommand = base.Cmd{ allowDeprecatedImage, _ := cmd.Flags().GetBool("allow-deprecated-image") if !image.Deprecated.IsZero() { if allowDeprecatedImage { - fmt.Printf("Attention: image %s is deprecated. It will continue to be available until %s.\n", image.Name, image.Deprecated.AddDate(0, 3, 0).Format("2006-01-02")) + fmt.Printf("Attention: image %s is deprecated. It will continue to be available until %s.\n", image.Name, image.Deprecated.AddDate(0, 3, 0).Format(time.DateOnly)) } else { - return fmt.Errorf("image %s is deprecated, please use --allow-deprecated-image to create a server with this image. It will continue to be available until %s", image.Name, image.Deprecated.AddDate(0, 3, 0).Format("2006-01-02")) + return fmt.Errorf("image %s is deprecated, please use --allow-deprecated-image to create a server with this image. It will continue to be available until %s", image.Name, image.Deprecated.AddDate(0, 3, 0).Format(time.DateOnly)) } }