ColTypeDate: Now uses ::renderString{Left,Right}

This commit is contained in:
Paul Beckingham
2015-10-31 16:56:58 -04:00
parent ce507c0011
commit 46db62ff00

View File

@@ -142,62 +142,39 @@ void ColumnTypeDate::render (
// rc.dateformat // rc.dateformat
std::string format = context.config.get ("report." + _report + ".dateformat"); std::string format = context.config.get ("report." + _report + ".dateformat");
if (format == "") if (format == "")
{
format = context.config.get ("dateformat.report"); format = context.config.get ("dateformat.report");
if (format == "") if (format == "")
format = context.config.get ("dateformat"); format = context.config.get ("dateformat");
}
lines.push_back ( renderStringLeft (lines, width, color, date.toString (format));
color.colorize (
leftJustify (
date.toString (format), width)));
} }
else if (_style == "countdown") else if (_style == "countdown")
{ {
ISO8601d now; ISO8601d now;
renderStringRight (lines, width, color, ISO8601p (now - date).formatVague ());
lines.push_back (
color.colorize (
rightJustify (
ISO8601p (now - date).formatVague (), width)));
} }
else if (_style == "julian") else if (_style == "julian")
{ renderStringRight (lines, width, color, format (date.toJulian (), 13, 12));
lines.push_back (
color.colorize (
rightJustify (
format (date.toJulian (), 13, 12), width)));
}
else if (_style == "epoch") else if (_style == "epoch")
{ renderStringRight (lines, width, color, date.toEpochString ());
lines.push_back (
color.colorize (
rightJustify (
date.toEpochString (), width)));
}
else if (_style == "iso") else if (_style == "iso")
{ renderStringLeft (lines, width, color, date.toISO ());
lines.push_back (
color.colorize (
leftJustify (
date.toISO (), width)));
}
else if (_style == "age") else if (_style == "age")
{ {
ISO8601d now; ISO8601d now;
renderStringLeft (lines, width, color, ISO8601p (now - date).formatVague ());
lines.push_back (
color.colorize (
leftJustify (
ISO8601p (now - date).formatVague (), width)));
} }
else if (_style == "remaining") else if (_style == "remaining")
{ {
ISO8601d now; ISO8601d now;
if (date > now) if (date > now)
lines.push_back ( renderStringRight (lines, width, color, ISO8601p (date - now).formatVague ());
color.colorize (
rightJustify (
ISO8601p (date - now).formatVague (), width)));
} }
} }
} }