fix: pytz to filter out deprecated timezones (#38751)
This commit is contained in:
parent
8054844193
commit
b484cf0136
2 changed files with 9 additions and 4 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
import re
|
import re
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from functools import cached_property
|
from functools import cached_property, lru_cache
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
|
|
@ -894,9 +894,14 @@ class User(Document):
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_timezones():
|
def get_timezones():
|
||||||
import zoneinfo
|
return {"timezones": _get_timezones()}
|
||||||
|
|
||||||
return {"timezones": zoneinfo.available_timezones()}
|
|
||||||
|
@lru_cache(maxsize=1)
|
||||||
|
def _get_timezones():
|
||||||
|
import pytz
|
||||||
|
|
||||||
|
return sorted(pytz.common_timezones)
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue