1
0
mirror of https://github.com/janeczku/calibre-web.git synced 2024-11-28 08:58:41 +02:00

Workaround for #889

This commit is contained in:
Ozzieisaacs 2019-04-23 21:32:48 +02:00
parent 6a7b8c7870
commit f941908f73

View File

@ -407,9 +407,14 @@ def mimetype_filter(val):
@app.template_filter('formatdate') @app.template_filter('formatdate')
def formatdate_filter(val): def formatdate_filter(val):
conformed_timestamp = re.sub(r"[:]|([-](?!((\d{2}[:]\d{2})|(\d{4}))$))", '', val) try:
formatdate = datetime.datetime.strptime(conformed_timestamp[:15], "%Y%m%d %H%M%S") conformed_timestamp = re.sub(r"[:]|([-](?!((\d{2}[:]\d{2})|(\d{4}))$))", '', val)
return format_date(formatdate, format='medium', locale=get_locale()) formatdate = datetime.datetime.strptime(conformed_timestamp[:15], "%Y%m%d %H%M%S")
return format_date(formatdate, format='medium', locale=get_locale())
except AttributeError as e:
app.logger.error('Babel error: %s, Current user locale: %s, Current User: %s' % (e, current_user.locale, current_user.nickname))
return formatdate
@app.template_filter('formatdateinput') @app.template_filter('formatdateinput')