CmdInfo: Properly format date and duration UDAs

The 'type' variable was never assigned value, hence the checking for
'date' and/or 'duration' always failed. Use col->type() instead.

Closes #2060.
This commit is contained in:
Tomas Babej 2020-12-28 20:36:04 -05:00
parent 3b978ce265
commit 6ff63286b5
No known key found for this signature in database
GPG key ID: B0747C6578F7D2F5

View file

@ -377,7 +377,6 @@ int CmdInfo::execute (std::string& output)
// Show any UDAs // Show any UDAs
auto all = task.all (); auto all = task.all ();
std::string type;
for (auto& att: all) for (auto& att: all)
{ {
if (Context::getContext ().columns.find (att) != Context::getContext ().columns.end ()) if (Context::getContext ().columns.find (att) != Context::getContext ().columns.end ())
@ -391,9 +390,9 @@ int CmdInfo::execute (std::string& output)
row = view.addRow (); row = view.addRow ();
view.set (row, 0, col->label ()); view.set (row, 0, col->label ());
if (type == "date") if (col->type () == "date")
value = Datetime (value).toString (dateformat); value = Datetime (value).toString (dateformat);
else if (type == "duration") else if (col->type () == "duration")
{ {
Duration iso; Duration iso;
std::string::size_type cursor = 0; std::string::size_type cursor = 0;