This commit is contained in:
Kovid Goyal 2022-01-17 12:09:16 +05:30
parent d72a4a106f
commit 575c46310a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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', '', ''),