mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion: WHen inserting the publication year in the metadata jacket, do so in the local time zone, so it matches what is displayed in the main calibre program. Fixes #1703439 [wrong pubdate on the jacket if set to 01/01/YYYY](https://bugs.launchpad.net/calibre/+bug/1703439)
This commit is contained in:
parent
9bf00e26bb
commit
af6159bc55
@ -610,7 +610,7 @@ OptionRecommendation(name='language',
|
|||||||
|
|
||||||
OptionRecommendation(name='pubdate',
|
OptionRecommendation(name='pubdate',
|
||||||
recommended_value=None, level=OptionRecommendation.LOW,
|
recommended_value=None, level=OptionRecommendation.LOW,
|
||||||
help=_('Set the publication date.')),
|
help=_('Set the publication date (assumed to be in the local timezone, unless the timezone is explicitly specified)')),
|
||||||
|
|
||||||
OptionRecommendation(name='timestamp',
|
OptionRecommendation(name='timestamp',
|
||||||
recommended_value=None, level=OptionRecommendation.LOW,
|
recommended_value=None, level=OptionRecommendation.LOW,
|
||||||
@ -895,7 +895,7 @@ OptionRecommendation(name='search_replace',
|
|||||||
continue
|
continue
|
||||||
elif x in ('timestamp', 'pubdate'):
|
elif x in ('timestamp', 'pubdate'):
|
||||||
try:
|
try:
|
||||||
val = parse_date(val, assume_utc=x=='pubdate')
|
val = parse_date(val, assume_utc=x=='timestamp')
|
||||||
except:
|
except:
|
||||||
self.log.exception(_('Failed to parse date/time') + ' ' +
|
self.log.exception(_('Failed to parse date/time') + ' ' +
|
||||||
unicode(val))
|
unicode(val))
|
||||||
|
@ -17,7 +17,7 @@ from calibre.constants import iswindows
|
|||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
from calibre.ebooks.oeb.base import XPath, XHTML_NS, XHTML, xml2text, urldefrag
|
from calibre.ebooks.oeb.base import XPath, XHTML_NS, XHTML, xml2text, urldefrag
|
||||||
from calibre.library.comments import comments_to_html
|
from calibre.library.comments import comments_to_html
|
||||||
from calibre.utils.date import is_date_undefined
|
from calibre.utils.date import is_date_undefined, as_local_time
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
from calibre.ebooks.chardet import strip_encoding_declarations
|
from calibre.ebooks.chardet import strip_encoding_declarations
|
||||||
from calibre.ebooks.metadata import fmt_sidx, rating_to_stars
|
from calibre.ebooks.metadata import fmt_sidx, rating_to_stars
|
||||||
@ -220,7 +220,8 @@ def render_jacket(mi, output_profile,
|
|||||||
if is_date_undefined(mi.pubdate):
|
if is_date_undefined(mi.pubdate):
|
||||||
pubdate = ''
|
pubdate = ''
|
||||||
else:
|
else:
|
||||||
pubdate = strftime(u'%Y', mi.pubdate.timetuple())
|
dt = as_local_time(mi.pubdate)
|
||||||
|
pubdate = strftime(u'%Y', dt.timetuple())
|
||||||
except:
|
except:
|
||||||
pubdate = ''
|
pubdate = ''
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user