From: Tomas Babej Date: Wed, 18 Mar 2015 23:03:34 +0000 (+0100) Subject: SerializingObject: Restrict usage of 'task calc' conversion for those TW versions... X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/6442ec8c37f93ba29f0df743b6da29913857707e?ds=sidebyside;hp=-c SerializingObject: Restrict usage of 'task calc' conversion for those TW versions that contain it --- 6442ec8c37f93ba29f0df743b6da29913857707e diff --git a/tasklib/task.py b/tasklib/task.py index e0e1040..b9103d1 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -262,8 +262,10 @@ class SerializingObject(object): # If the value is already localized, there is no need to change # time zone at this point. Also None is a valid value too. localized = value - elif isinstance(value, six.string_types): + elif (isinstance(value, six.string_types) + and self.warrior.version > VERSION_2_4_0): # For strings, use 'task calc' to evaluate the string to datetime + # available since TW 2.4.0 args = value.split() result = self.warrior.execute_command(['calc'] + args) naive = datetime.datetime.strptime(result[0], DATE_FORMAT_CALC)