Fixes #1966611 [Error in book details search: date/timestamp confusion](https://bugs.launchpad.net/calibre/+bug/1966611)
This commit is contained in:
Kovid Goyal 2022-03-28 19:49:32 +05:30
commit bd9a37fdf8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -281,13 +281,14 @@ def mi_to_html(
if is_date_undefined(aval): if is_date_undefined(aval):
continue continue
aval = format_date(aval, 'yyyy-MM-dd') aval = format_date(aval, 'yyyy-MM-dd')
key = field if field != 'timestamp' else 'date'
if val == aval: if val == aval:
val = '<a href="{}" title="{}">{}</a>'.format( val = '<a href="{}" title="{}">{}</a>'.format(
search_action_with_data(field, str(aval), book_id, None, original_value=val), a( search_action_with_data(key, str(aval), book_id, None, original_value=val), a(
_('Click to see books with {0}: {1}').format(metadata['name'] or field, val)), val) _('Click to see books with {0}: {1}').format(metadata['name'] or field, val)), val)
else: else:
val = '<a href="{}" title="{}">{}</a>'.format( val = '<a href="{}" title="{}">{}</a>'.format(
search_action_with_data(field, str(aval), book_id, None, original_value=val), a( search_action_with_data(key, str(aval), book_id, None, original_value=val), a(
_('Click to see books with {0}: {1} (derived from {2})').format( _('Click to see books with {0}: {1} (derived from {2})').format(
metadata['name'] or field, aval, val)), val) metadata['name'] or field, aval, val)), val)
elif metadata['datatype'] == 'text' and metadata['is_multiple']: elif metadata['datatype'] == 'text' and metadata['is_multiple']: