diff --git a/src/pyj/date.pyj b/src/pyj/date.pyj index ec7727a829..279ac8d782 100644 --- a/src/pyj/date.pyj +++ b/src/pyj/date.pyj @@ -76,13 +76,17 @@ def fd_format_timezone(dt, ampm, t, as_utc): def get_ampm_text(which): ans = get_ampm_text[which] if not ans: - d = Date() - if which is 'am': - d.setHours(1, 0, 0, 0) - else: - d.setHours(13, 0, 0, 0) - x = window.Intl.DateTimeFormat('default', { 'hour': 'numeric', 'hour12': True }).format(d) - ans = get_ampm_text[which] = x.replace(/\d+/g, '').trim() or which.toUpperCase() + try: + d = Date() + if which is 'am': + d.setHours(1, 0, 0, 0) + else: + d.setHours(13, 0, 0, 0) + 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