mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DRYer
This commit is contained in:
parent
d72a4a106f
commit
575c46310a
@ -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', '', ''),
|
||||
|
Loading…
x
Reference in New Issue
Block a user