Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/cbhaley/calibre
Browse files Browse the repository at this point in the history
Fixes #1950758 [Book details: Adjustments to search when clicking on a datetime column](https://bugs.launchpad.net/calibre/+bug/1950758)
  • Loading branch information
kovidgoyal committed Nov 12, 2021
2 parents 9375ee1 + 0613b43 commit 51478dd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/calibre/ebooks/metadata/book/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from calibre.library.comments import comments_to_html, markdown
from calibre.utils.icu import sort_key
from calibre.utils.formatter import EvalFormatter
from calibre.utils.date import is_date_undefined
from calibre.utils.date import is_date_undefined, format_date
from calibre.utils.localization import calibre_langcode_to_name
from calibre.utils.serialize import json_dumps
from polyglot.binary import as_hex_unicode
Expand Down Expand Up @@ -281,9 +281,15 @@ def mi_to_html(
aval = getattr(mi, field)
if is_date_undefined(aval):
continue
val = '<a href="%s" title="%s">%s</a>' % (
search_action_with_data(field, str(aval), book_id, None, original_value=val), a(
_('Click to see books with {0}: {1} (derived from {2})').format(
aval = format_date(aval, 'yyyy-MM-dd')
if val == aval:
val = '<a href="%s" title="%s">%s</a>' % (
search_action_with_data(field, str(aval), book_id, None, original_value=val), a(
_('Click to see books with {0}: {1}').format(metadata['name'] or field, val)), val)
else:
val = '<a href="%s" title="%s">%s</a>' % (
search_action_with_data(field, str(aval), book_id, None, original_value=val), a(
_('Click to see books with {0}: {1} (derived from {2})').format(
metadata['name'] or field, aval, val)), val)
elif metadata['datatype'] == 'text' and metadata['is_multiple']:
try:
Expand Down

0 comments on commit 51478dd

Please sign in to comment.