Skip to content

Commit d8931cb

Browse files
authored
Use formatted UTC time for fallback in slack message (#225)
* Use formatted UTC time for fallback in slack message * Lint
1 parent 193519a commit d8931cb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

engine/apps/slack/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from datetime import datetime
12
from textwrap import wrap
23

34
from apps.slack.slack_client import SlackClientWithErrorHandling
@@ -58,7 +59,8 @@ def post_message_to_channel(organization, channel_id, text):
5859

5960

6061
def format_datetime_to_slack(timestamp, format="date_short"):
61-
return f"<!date^{timestamp}^{{{format}}} {{time}}|{timestamp}>"
62+
fallback = datetime.utcfromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M (UTC)")
63+
return f"<!date^{timestamp}^{{{format}}} {{time}}|{fallback}>"
6264

6365

6466
def get_cache_key_update_incident_slack_message(alert_group_pk):

0 commit comments

Comments
 (0)