Another try at fixing the failing test

This commit is contained in:
Kovid Goyal 2025-04-05 10:55:03 +05:30
parent 23187893ba
commit df69f96a92
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -76,13 +76,17 @@ def fd_format_timezone(dt, ampm, t, as_utc):
def get_ampm_text(which): def get_ampm_text(which):
ans = get_ampm_text[which] ans = get_ampm_text[which]
if not ans: if not ans:
d = Date() try:
if which is 'am': d = Date()
d.setHours(1, 0, 0, 0) if which is 'am':
else: d.setHours(1, 0, 0, 0)
d.setHours(13, 0, 0, 0) else:
x = window.Intl.DateTimeFormat('default', { 'hour': 'numeric', 'hour12': True }).format(d) d.setHours(13, 0, 0, 0)
ans = get_ampm_text[which] = x.replace(/\d+/g, '').trim() or which.toUpperCase() x = window.Intl.DateTimeFormat('default', { 'hour': 'numeric', 'hour12': True }).format(d)
ans = x.replace(/\d+/g, '').trim() or which.toUpperCase()
except:
ans = which.toUpperCase()
get_ampm_text[which] = ans
return ans return ans