11# https://github.com/python/mypy/issues/1141
22from typing import Dict , Optional
33
4+ import zulip
5+
46# Change these values to configure authentication for the plugin
5768ZULIP_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 .replace ("" , "T" , 1 ))
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>`.
4552def format_deployment_message (
4653 app_name : str = "" ,
4754 url : str = "" ,
0 commit comments