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

View file

@ -40,10 +40,6 @@ ColumnDue::ColumnDue ()
{ {
_name = "due"; _name = "due";
_label = STRING_COLUMN_LABEL_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"; _name = "scheduled";
_label = STRING_COLUMN_LABEL_SCHED; _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 () ColumnStart::ColumnStart ()
{ {
_name = "start"; _name = "start";
_label = STRING_COLUMN_LABEL_STARTED; _label = STRING_COLUMN_LABEL_STARTED;
_styles = {"active"};
_examples = {context.config.get ("active.indicator")}; _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 ()) if (created.length ())
{ {
Date dt (strtol (created.c_str (), NULL, 10)); Date dt (strtol (created.c_str (), NULL, 10));
age = ISO8601p (now - dt).format (); age = ISO8601p (now - dt).formatVague ();
} }
view.set (row, 1, entry + " (" + age + ")"); view.set (row, 1, entry + " (" + age + ")");
@ -289,7 +289,7 @@ int CmdInfo::execute (std::string& output)
view.set (row, 0, STRING_CMD_INFO_MODIFIED); view.set (row, 0, STRING_CMD_INFO_MODIFIED);
Date mod (task.get_date ("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 + ")"); view.set (row, 1, mod.toString (dateformat) + " (" + age + ")");
} }