mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Bug #1925378: Error when trying to edit Undefined Date
This commit is contained in:
parent
4796b030db
commit
8a02c33eb6
@ -247,6 +247,8 @@ class DateDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{
|
||||
val = now()
|
||||
else:
|
||||
val = index.data(Qt.ItemDataRole.EditRole)
|
||||
if is_date_undefined(val):
|
||||
val = now()
|
||||
editor.setDateTime(val)
|
||||
|
||||
# }}}
|
||||
|
@ -157,6 +157,8 @@ safeyear = lambda x: min(max(x, MINYEAR), MAXYEAR)
|
||||
|
||||
def qt_to_dt(qdate_or_qdatetime, as_utc=True):
|
||||
o = qdate_or_qdatetime
|
||||
if o is None:
|
||||
return UNDEFINED_DATE
|
||||
if hasattr(o, 'toUTC'):
|
||||
# QDateTime
|
||||
o = o.toUTC()
|
||||
|
Loading…
x
Reference in New Issue
Block a user