TW-1500: Dates formatted as ".age", ".remaining", or ".countdown" often give blank results

- The 'age' column regained the ability to show negative durations.
- The 'countdown' and 'remaining' continue to show only positive values, by
  design.
- Thanks to Jeremy John Reeder.
This commit is contained in:
Paul Beckingham
2015-11-16 07:41:41 -05:00
parent f71630a416
commit ba098d790f
3 changed files with 15 additions and 5 deletions

View File

@@ -92,7 +92,8 @@ void ColumnTypeDate::measure (Task& task, unsigned int& minimum, unsigned int& m
else if (_style == "countdown")
{
ISO8601d now;
minimum = maximum = ISO8601p (now - date).formatVague ().length ();
if (now > date)
minimum = maximum = ISO8601p (now - date).formatVague ().length ();
}
else if (_style == "julian")
{
@@ -109,7 +110,10 @@ void ColumnTypeDate::measure (Task& task, unsigned int& minimum, unsigned int& m
else if (_style == "age")
{
ISO8601d now;
minimum = maximum = ISO8601p (now - date).formatVague ().length ();
if (now > date)
minimum = maximum = ISO8601p (now - date).formatVague ().length ();
else
minimum = maximum = ISO8601p (date - now).formatVague ().length () + 1;
}
else if (_style == "remaining")
{
@@ -153,7 +157,8 @@ void ColumnTypeDate::render (
else if (_style == "countdown")
{
ISO8601d now;
renderStringRight (lines, width, color, ISO8601p (now - date).formatVague ());
if (now > date)
renderStringRight (lines, width, color, ISO8601p (now - date).formatVague ());
}
else if (_style == "julian")
renderStringRight (lines, width, color, format (date.toJulian (), 13, 12));
@@ -167,7 +172,10 @@ void ColumnTypeDate::render (
else if (_style == "age")
{
ISO8601d now;
renderStringLeft (lines, width, color, ISO8601p (now - date).formatVague ());
if (now > date)
renderStringLeft (lines, width, color, ISO8601p (now - date).formatVague ());
else
renderStringLeft (lines, width, color, "-" + ISO8601p (date - now).formatVague ());
}
else if (_style == "remaining")