vwtask: Use more reliable way of testing if due date does not have time component

This commit is contained in:
Tomas Babej 2018-07-15 18:23:39 -04:00
parent 6174a28b02
commit b5caafd302
No known key found for this signature in database
GPG key ID: B0747C6578F7D2F5
2 changed files with 10 additions and 1 deletions

View file

@ -428,3 +428,11 @@ def get_var(name, default=None, vars_obj=None):
return default
else:
return decode_bytes(value)
def is_midnight(dt):
"""
Determines if given datetime object is set to midnight.
"""
return dt.hour == 0 and dt.minute == 0 and dt.second == 0

View file

@ -323,7 +323,8 @@ class VimwikiTask(object):
def __str__(self):
due_str = ' ' + (
self['due'].strftime(regexp.DATETIME_FORMAT) if self['due'].time() else
self['due'].strftime(regexp.DATETIME_FORMAT)
if not util.is_midnight(self['due']) else
self['due'].strftime(regexp.DATE_FORMAT)
) if self['due'] else ''