diff --git a/cmd/lk/agent.go b/cmd/lk/agent.go index fbca6857..8adcabc1 100644 --- a/cmd/lk/agent.go +++ b/cmd/lk/agent.go @@ -1568,7 +1568,7 @@ func listAgents(ctx context.Context, cmd *cli.Command) error { strings.Join(regions, ","), strings.Join(deployments, ","), agent.Version, - formatTime(agent.DeployedAt.AsTime()), + formatDeployedAt(agent.DeployedAt.AsTime()), }) } diff --git a/cmd/lk/utils.go b/cmd/lk/utils.go index 378fdf41..34d49191 100644 --- a/cmd/lk/utils.go +++ b/cmd/lk/utils.go @@ -495,3 +495,10 @@ func formatTime(t time.Time) string { } return t.Format(time.RFC3339) } + +func formatDeployedAt(t time.Time) string { + if t.IsZero() { + return "never deployed" + } + return t.Format(time.RFC3339) +}