TW-1630: "Due" parsing behavior seems inconsistent

- Thanks to Jim B.
This commit is contained in:
Paul Beckingham 2015-08-05 17:06:43 -04:00
parent f9b5513882
commit 2f61a7e946
2 changed files with 25 additions and 3 deletions

View file

@ -81,6 +81,7 @@
- TW-1627 'mon' is replaced with date in project field (thanks to James Cline). - TW-1627 'mon' is replaced with date in project field (thanks to James Cline).
- TW-1629 Descriptions often get overwritten with "( or )" (thanks to Jeremy - TW-1629 Descriptions often get overwritten with "( or )" (thanks to Jeremy
John Reeder). John Reeder).
- TW-1630 "Due" parsing behavior seems inconsistent (thanks to Jim B).
- TW-1632 Japanese translation for Taskwarrior(150713) (thanks to ribbon). - TW-1632 Japanese translation for Taskwarrior(150713) (thanks to ribbon).
- TW-1634 due.not:<date> excludes only tasks scheduled at mitnight (thanks to - TW-1634 due.not:<date> excludes only tasks scheduled at mitnight (thanks to
Tomas Babej). Tomas Babej).

View file

@ -1942,11 +1942,32 @@ void Variant::cast (const enum type new_type)
pos == _string.length ()) pos == _string.length ())
{ {
_date = (time_t) iso; _date = (time_t) iso;
break;
} }
else if (dateFormat != "")
pos = 0;
ISO8601p isop;
if (isoEnabled &&
isop.parse (_string, pos) &&
pos == _string.length ())
{ {
Date d (_string, dateFormat); _date = Date ().toEpoch () + (time_t) isop;
_date = d.toEpoch (); break;
}
pos = 0;
Duration dur;
if (dur.parse (_string, pos) &&
pos == _string.length ())
{
_date = Date ().toEpoch () + (time_t) dur;
break;
}
if (dateFormat != "")
{
_date = Date (_string, dateFormat).toEpoch ();
break;
} }
} }
break; break;