mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make date.format_date render UNDEFINED_DATE as ''. This makes composite columns and templates behave in the same fashion as the GUI has for some time.
This commit is contained in:
parent
4a9e8bcb2f
commit
5c4154bb0d
@ -148,6 +148,9 @@ def format_date(dt, format, assume_utc=False, as_utc=False):
|
||||
if len(mo.group(0)) == 2: return '%02d'%(dt.year % 100)
|
||||
return '%04d'%dt.year
|
||||
|
||||
if dt == UNDEFINED_DATE:
|
||||
return ''
|
||||
|
||||
format = re.sub('d{1,4}', format_day, format)
|
||||
format = re.sub('M{1,4}', format_month, format)
|
||||
return re.sub('yyyy|yy', format_year, format)
|
||||
|
Loading…
x
Reference in New Issue
Block a user