mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix failing test
This commit is contained in:
parent
3b95ee47ba
commit
23187893ba
@ -289,7 +289,12 @@ def timestampfromdt(dt, assume_utc=True):
|
||||
# Format date functions {{{
|
||||
|
||||
def fd_format_hour(dt, ampm, hr):
|
||||
h = int(strftime('%I' if ampm else '%H', t=dt.timetuple()).strip())
|
||||
try:
|
||||
h = int(strftime('%I' if ampm else '%H', t=dt.timetuple()).strip())
|
||||
except Exception:
|
||||
h = dt.hour
|
||||
if ampm:
|
||||
h %= 12
|
||||
if len(hr) == 1:
|
||||
return f'{h}'
|
||||
return f'{h:02}'
|
||||
|
@ -82,7 +82,7 @@ def get_ampm_text(which):
|
||||
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()
|
||||
ans = get_ampm_text[which] = x.replace(/\d+/g, '').trim() or which.toUpperCase()
|
||||
return ans
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user