Skip to content

Commit 59fa607

Browse files
committed
openshift: Add a helper function to parse the datetime for the template.
1 parent ac76030 commit 59fa607

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

zulip/integrations/openshift/zulip_openshift_config.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# https://github.com/python/mypy/issues/1141
22
from typing import Dict, Optional
33

4+
import zulip
5+
46
# Change these values to configure authentication for the plugin
57
ZULIP_USER = "[email protected]"
68
ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
@@ -28,6 +30,14 @@ def deployment_notice_destination(branch: str) -> Optional[Dict[str, str]]:
2830
return None
2931

3032

33+
# To utilize Zulip's global times (https://zulip.com/help/global-times)
34+
# call this function from format_deployment_message, and use the
35+
# returned string in your message template.
36+
def get_global_time(dt_str: str) -> str:
37+
dt = zulip.datetime_fromisoformat(dt_str)
38+
return zulip.datetime_to_global_time(dt)
39+
40+
3141
# Modify this function to change how deployments are displayed
3242
#
3343
# It takes the following arguments:
@@ -39,9 +49,6 @@ def deployment_notice_destination(branch: str) -> Optional[Dict[str, str]]:
3949
# * commit_id = hash of the commit that triggered the deployment
4050
# * dep_id = deployment id
4151
# * dep_time = deployment timestamp
42-
#
43-
# To utilize Zulip's global times (https://zulip.com/help/global-times),
44-
# use the syntax `<time:dep_time>`.
4552
def format_deployment_message(
4653
app_name: str = "",
4754
url: str = "",

0 commit comments

Comments
 (0)