2020-09-29 22:20:46 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import json
|
|
|
|
import os
|
2022-02-10 01:45:44 +01:00
|
|
|
import sys
|
2020-09-29 22:20:46 +02:00
|
|
|
|
2022-06-28 00:43:57 +02:00
|
|
|
if sys.version_info < (3, 9):
|
|
|
|
from backports import zoneinfo
|
|
|
|
else:
|
|
|
|
import zoneinfo
|
2020-09-29 22:20:46 +02:00
|
|
|
|
2021-02-12 08:20:45 +01:00
|
|
|
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../")
|
2022-02-10 01:45:44 +01:00
|
|
|
sys.path.insert(0, ZULIP_PATH)
|
|
|
|
|
|
|
|
from zerver.lib.timezone import get_canonical_timezone_map
|
|
|
|
|
2023-02-22 23:03:47 +01:00
|
|
|
OUT_PATH = os.path.join(ZULIP_PATH, "web", "generated", "timezones.json")
|
2020-09-29 22:20:46 +02:00
|
|
|
|
2021-02-12 08:20:45 +01:00
|
|
|
with open(OUT_PATH, "w") as f:
|
2022-06-28 00:43:57 +02:00
|
|
|
json.dump(
|
|
|
|
{
|
|
|
|
"timezones": sorted(
|
|
|
|
zoneinfo.available_timezones()
|
|
|
|
- {"Factory", "localtime"}
|
|
|
|
- set(get_canonical_timezone_map())
|
|
|
|
)
|
|
|
|
},
|
|
|
|
f,
|
|
|
|
)
|