diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index 07aee5c6fa..e03b0680be 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -44,7 +44,7 @@ bool_custom_columns_are_tristate = 'yes' # title within authors. sort_columns_at_startup = None -# Format to be used for publication date +# Format to be used for publication date and the timestamp (date). # A string controlling how the publication date is displayed in the GUI # d the day as number without a leading zero (1 to 31) # dd the day as number with a leading zero (01 to 31) @@ -59,8 +59,10 @@ sort_columns_at_startup = None # For example, given the date of 9 Jan 2010, the following formats show # MMM yyyy ==> Jan 2010 yyyy ==> 2010 dd MMM yyyy ==> 09 Jan 2010 # MM/yyyy ==> 01/2010 d/M/yy ==> 9/1/10 yy ==> 10 -# default if not set: MMM yyyy +# publication default if not set: MMM yyyy +# timestamp default if not set: dd MMM yyyy gui_pubdate_display_format = 'MMM yyyy' +gui_timestamp_display_format = 'dd MMM yyyy' # Control title and series sorting in the library view. # If set to 'library_order', Leading articles such as The and A will be ignored. diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index 40f7a2e4e0..d98d9a240b 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -98,14 +98,14 @@ class DateDelegate(QStyledItemDelegate): # {{{ d = val.toDate() if d <= UNDEFINED_QDATE: return '' - return format_date(d.toPyDate(), 'dd MMM yyyy') + format = tweaks['gui_timestamp_display_format'] + if format is None: + format = 'dd MMM yyyy' + return format_date(d.toPyDate(), format) def createEditor(self, parent, option, index): qde = QStyledItemDelegate.createEditor(self, parent, option, index) - stdformat = unicode(qde.displayFormat()) - if 'yyyy' not in stdformat: - stdformat = stdformat.replace('yy', 'yyyy') - qde.setDisplayFormat(stdformat) + qde.setDisplayFormat('dd MMM yyyy') qde.setMinimumDate(UNDEFINED_QDATE) qde.setSpecialValueText(_('Undefined')) qde.setCalendarPopup(True)