Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use UTC when rendering alert and silence dates #2439

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/alert_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ func (a *alertAddCmd) addAlert(ctx context.Context, _ *kingpin.ParseContext) err
Labels: labels,
},
Annotations: annotations,
StartsAt: strfmt.DateTime(startsAt),
EndsAt: strfmt.DateTime(endsAt),
StartsAt: strfmt.DateTime(startsAt.UTC()),
EndsAt: strfmt.DateTime(endsAt.UTC()),
}
alertParams := alert.NewPostAlertsParams().WithContext(ctx).
WithAlerts(models.PostableAlerts{pa})
Expand Down
4 changes: 2 additions & 2 deletions cli/silence_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ func (c *silenceAddCmd) add(ctx context.Context, _ *kingpin.ParseContext) error
return err
}

start := strfmt.DateTime(startsAt)
end := strfmt.DateTime(endsAt)
start := strfmt.DateTime(startsAt.UTC())
end := strfmt.DateTime(endsAt.UTC())
ps := &models.PostableSilence{
Silence: models.Silence{
Matchers: typeMatchers,
Expand Down
4 changes: 2 additions & 2 deletions cli/silence_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (c *silenceUpdateCmd) update(ctx context.Context, _ *kingpin.ParseContext)
if err != nil {
return err
}
startsAt := strfmt.DateTime(startsAtTime)
startsAt := strfmt.DateTime(startsAtTime.UTC())
sil.StartsAt = &startsAt
}

Expand All @@ -82,7 +82,7 @@ func (c *silenceUpdateCmd) update(ctx context.Context, _ *kingpin.ParseContext)
if err != nil {
return err
}
endsAt := strfmt.DateTime(endsAtTime)
endsAt := strfmt.DateTime(endsAtTime.UTC())
sil.EndsAt = &endsAt
} else if c.duration != "" {
d, err := model.ParseDuration(c.duration)
Expand Down