Commit 19fe7d34 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Always try to convert tag values to a (humanized) date

For other tags containing date values, try to print the relative
humanized date as well. If the tag does not contain a date in YYYY-MM-DD
value, it's normal value is printed.
parent a97a9b53
...@@ -23,7 +23,7 @@ from datetime import date ...@@ -23,7 +23,7 @@ from datetime import date
from topydo.lib.Config import config from topydo.lib.Config import config
from topydo.lib.Importance import average_importance, importance from topydo.lib.Importance import average_importance, importance
from topydo.lib.Utils import humanize_date from topydo.lib.Utils import date_string_to_date, humanize_date
Field = namedtuple('Field', ['sort', 'group', 'label']) Field = namedtuple('Field', ['sort', 'group', 'label'])
...@@ -226,6 +226,11 @@ class Sorter(object): ...@@ -226,6 +226,11 @@ class Sorter(object):
else: else:
result = p_todo.tag_value(p_field) result = p_todo.tag_value(p_field)
try:
result = humanize_date(date_string_to_date(result))
except ValueError:
pass
return result return result
if p_field in FIELD_MAP: if p_field in FIELD_MAP:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment