Quote:
Originally Posted by ownedbycats
Just out of curiosity, I put this in the template tester:
I always end up with [year]-10-15. Where does the October 15th date come from? I thought it'd be the current date, but it's only the 11th where I live.
|
The template processor uses calibre's date parser, which is
dateutil. When it parses a date, missing fields come from "default". In calibre, default is specified as
Code:
func = datetime.utcnow if assume_utc else datetime.now
default = func().replace(day=15, hour=0, minute=0, second=0, microsecond=0,
tzinfo=_utc_tz if assume_utc else _local_tz)
The variable assume_utc is False.
As such, a missing month is the current local month and a missing day is the 15th. A missing time becomes midnight. I don't know if one can have a missing year, but if so then it would be the current year.