ISO8601: Converted various calls of ::format to ::formatVague

This commit is contained in:
Paul Beckingham 2015-08-12 21:35:09 -04:00
parent 35b52c421b
commit 995de68c90
5 changed files with 14 additions and 22 deletions

View file

@ -56,7 +56,7 @@ ColumnDate::ColumnDate ()
format (now.toJulian (), 13, 12),
now.toEpochString (),
now.toISO (),
ISO8601p (Date () - now).format (),
ISO8601p (Date () - now).formatVague (),
"",
ISO8601p (Date () - now).format ()};
}
@ -94,7 +94,7 @@ void ColumnDate::measure (Task& task, unsigned int& minimum, unsigned int& maxim
else if (_style == "countdown")
{
Date now;
minimum = maximum = ISO8601p (now - date).format ().length ();
minimum = maximum = ISO8601p (now - date).formatVague ().length ();
}
else if (_style == "julian")
{
@ -111,13 +111,13 @@ void ColumnDate::measure (Task& task, unsigned int& minimum, unsigned int& maxim
else if (_style == "age")
{
Date now;
minimum = maximum = ISO8601p (now - date).format ().length ();
minimum = maximum = ISO8601p (now - date).formatVague ().length ();
}
else if (_style == "remaining")
{
Date now;
if (date > now)
minimum = maximum = ISO8601p (date - now).format ().length ();
minimum = maximum = ISO8601p (date - now).formatVague ().length ();
}
else
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
@ -160,7 +160,7 @@ void ColumnDate::render (
lines.push_back (
color.colorize (
rightJustify (
ISO8601p (now - date).format (), width)));
ISO8601p (now - date).formatVague (), width)));
}
else if (_style == "julian")
{
@ -190,7 +190,7 @@ void ColumnDate::render (
lines.push_back (
color.colorize (
leftJustify (
ISO8601p (now - date).format (), width)));
ISO8601p (now - date).formatVague (), width)));
}
else if (_style == "remaining")
{
@ -199,7 +199,7 @@ void ColumnDate::render (
lines.push_back (
color.colorize (
rightJustify (
ISO8601p (date - now).format (), width)));
ISO8601p (date - now).formatVague (), width)));
}
}
}

View file

@ -40,10 +40,6 @@ ColumnDue::ColumnDue ()
{
_name = "due";
_label = STRING_COLUMN_LABEL_DUE;
Date now;
now += 125;
_examples.push_back (ISO8601p (now - Date ()).format ());
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -40,11 +40,6 @@ ColumnScheduled::ColumnScheduled ()
{
_name = "scheduled";
_label = STRING_COLUMN_LABEL_SCHED;
_styles = {"countdown"};
Date now;
now += 125;
_examples = {ISO8601p (now - Date ()).format ()};
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -36,10 +36,11 @@ extern Context context;
////////////////////////////////////////////////////////////////////////////////
ColumnStart::ColumnStart ()
{
_name = "start";
_label = STRING_COLUMN_LABEL_STARTED;
_styles = {"active"};
_examples = {context.config.get ("active.indicator")};
_name = "start";
_label = STRING_COLUMN_LABEL_STARTED;
_styles.push_back ("active");
_examples.push_back (context.config.get ("active.indicator"));
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -229,7 +229,7 @@ int CmdInfo::execute (std::string& output)
if (created.length ())
{
Date dt (strtol (created.c_str (), NULL, 10));
age = ISO8601p (now - dt).format ();
age = ISO8601p (now - dt).formatVague ();
}
view.set (row, 1, entry + " (" + age + ")");
@ -289,7 +289,7 @@ int CmdInfo::execute (std::string& output)
view.set (row, 0, STRING_CMD_INFO_MODIFIED);
Date mod (task.get_date ("modified"));
std::string age = ISO8601p (now - mod).format ();
std::string age = ISO8601p (now - mod).formatVague ();
view.set (row, 1, mod.toString (dateformat) + " (" + age + ")");
}