opensearch-project/alerting-dashboards-plugin

[BUG] Notification message preview shows times in wrong timezone

Open

#1,173 opened on Dec 9, 2024

 (1 comment) (0 reactions) (0 assignees)JavaScript (118 forks)auto 404
buggood first issue

Repository metrics

Stars
 (31 stars)
PR merge metrics
 (PR metrics pending)

Description

What is the bug? Currently, the alerting backend only supports sending trigger start/end time values in UTC format (see https://github.com/opensearch-project/alerting/issues/1744 for request to add custom timezone support). However, the notification message preview is displaying those values in the local timezone. Because the backend only supports UTC, the preview should also use UTC for a uniform experience.

This bug is likely caused by this function retrieving the timezone from the browser instead of always using UTC. https://github.com/opensearch-project/alerting-dashboards-plugin/blob/main/public/pages/CreateTrigger/utils/helper.js#L124C17-L124C28

Once the bug is fixed, the example message contents found here can be updated to reflect the UTC timezone. https://github.com/opensearch-project/alerting-dashboards-plugin/blob/main/public/pages/CreateTrigger/utils/constants.js#L9

For example, this message:

Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.
  - Trigger: {{ctx.trigger.name}}
  - Severity: {{ctx.trigger.severity}}
  - Period start: {{ctx.periodStart}}
  - Period end: {{ctx.periodEnd}}

Can be updated to this:

Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.
  - Trigger: {{ctx.trigger.name}}
  - Severity: {{ctx.trigger.severity}}
  - Period start: {{ctx.periodStart}} UTC
  - Period end: {{ctx.periodEnd}} UTC

Contributor guide