TW-1491 - TW-1491 Regression in deleting due dates

This commit is contained in:
Jens Erat 2015-01-11 17:02:21 +01:00 committed by Paul Beckingham
parent 5a3037f257
commit cd31335742

View file

@ -636,8 +636,9 @@ void Task::parseJSON (const std::string& line)
// Dates are converted from ISO to epoch. // Dates are converted from ISO to epoch.
else if (type == "date") else if (type == "date")
{ {
Date d (unquoteText (i->second->dump ())); std::string text = unquoteText (i->second->dump ());
set (i->first, d.toEpochString ()); Date d (text);
set (i->first, text == "" ? "" : d.toEpochString ());
} }
// Tags are an array of JSON strings. // Tags are an array of JSON strings.
@ -815,16 +816,12 @@ std::string Task::composeJSON (bool decorate /*= false*/) const
if (type == "date") if (type == "date")
{ {
Date d (i->second); Date d (i->second);
if (i->first == "modification") out << "\""
out << "\"modified\":\"" << (i->first == "modification" ? "modified" : i->first)
<< d.toISO () << "\":\""
<< "\""; // Date was deleted, do not export parsed empty string
else << (i->second == "" ? "" : d.toISO ())
out << "\"" << "\"";
<< i->first
<< "\":\""
<< d.toISO ()
<< "\"";
++attributes_written; ++attributes_written;
} }