mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-18 21:33:07 +02:00
vwtask: Use more reliable way of testing if due date does not have time component
This commit is contained in:
parent
6174a28b02
commit
b5caafd302
2 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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 ''
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue