From 575c46310a5ba8c6e0e3f2dc137d90a401e347e3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 17 Jan 2022 12:09:16 +0530 Subject: [PATCH] DRYer --- src/calibre/library/coloring.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/calibre/library/coloring.py b/src/calibre/library/coloring.py index 884da6cf35..63c256a23e 100644 --- a/src/calibre/library/coloring.py +++ b/src/calibre/library/coloring.py @@ -6,7 +6,6 @@ import json import re from textwrap import dedent -from calibre.utils.date import format_date, now from polyglot.binary import as_hex_unicode, from_hex_bytes color_row_key = '*row' @@ -180,8 +179,7 @@ class Rule: # {{{ if action == 'is not set': return ("test(field('%s'), '', '1')"%(col)) if action == 'is today': - today = format_date(now(), 'yyyy-MM-dd') - return f"strcmp(format_date(raw_field('{col}'), 'yyyy-MM-dd'), '{today}', '', '1', '')" + return f"strcmp(format_date(raw_field('{col}'), 'yyyy-MM-dd'), 'format_date(today(), 'yyyy-MM-dd')', '', '1', '')" lt, eq, gt = { 'eq': ('', '1', ''), 'lt': ('1', '', ''),