11# https://github.com/python/mypy/issues/1141
2+ from datetime import datetime
23from typing import Dict , Optional
34
5+ import zulip
6+
47# Change these values to configure authentication for the plugin
5869ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
@@ -28,6 +31,14 @@ def deployment_notice_destination(branch: str) -> Optional[Dict[str, str]]:
2831 return None
2932
3033
34+ # To utilize Zulip's global times (https://zulip.com/help/global-times)
35+ # call this function from format_deployment_message, and use the
36+ # returned string in your message template.
37+ def get_global_time (dt_str : str ) -> str :
38+ dt = datetime .strptime (dt_str , "%Y-%m-%d %H:%M:%S %z" )
39+ return zulip .datetime_to_global_time (dt )
40+
41+
3142# Modify this function to change how deployments are displayed
3243#
3344# It takes the following arguments:
@@ -39,9 +50,6 @@ def deployment_notice_destination(branch: str) -> Optional[Dict[str, str]]:
3950# * commit_id = hash of the commit that triggered the deployment
4051# * dep_id = deployment id
4152# * 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>`.
4553def format_deployment_message (
4654 app_name : str = "" ,
4755 url : str = "" ,
0 commit comments