mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
py3: Fix strftime on python3
This commit is contained in:
parent
c32b7daafa
commit
45975b0c39
@ -550,7 +550,9 @@ def strftime(fmt, t=None):
|
|||||||
fmt = fmt.replace(u'%e', u'%#d')
|
fmt = fmt.replace(u'%e', u'%#d')
|
||||||
ans = plugins['winutil'][0].strftime(fmt, t)
|
ans = plugins['winutil'][0].strftime(fmt, t)
|
||||||
else:
|
else:
|
||||||
ans = time.strftime(fmt, t).decode(preferred_encoding, 'replace')
|
ans = time.strftime(fmt, t)
|
||||||
|
if isinstance(ans, bytes):
|
||||||
|
ans = ans.decode(preferred_encoding, 'replace')
|
||||||
if early_year:
|
if early_year:
|
||||||
ans = ans.replace(u'_early year hack##', unicode_type(orig_year))
|
ans = ans.replace(u'_early year hack##', unicode_type(orig_year))
|
||||||
return ans
|
return ans
|
||||||
|
Loading…
x
Reference in New Issue
Block a user