mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug #986
- Complete the previous fix: dates in the journal entries are also formatted according to the correct configuration variable. - Add unit tests. Signed-off-by: Paul Beckingham <paul@beckingham.net>
This commit is contained in:
parent
8b18ee6f50
commit
3440eb0c10
4 changed files with 89 additions and 9 deletions
|
@ -168,7 +168,7 @@ std::string taskDifferences (const Task& before, const Task& after)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string taskInfoDifferences (const Task& before, const Task& after)
|
||||
std::string taskInfoDifferences (const Task& before, const Task& after, const std::string& dateformat)
|
||||
{
|
||||
// Attributes are all there is, so figure the different attribute names
|
||||
// between before and after.
|
||||
|
@ -232,7 +232,7 @@ std::string taskInfoDifferences (const Task& before, const Task& after)
|
|||
else
|
||||
out << format (STRING_FEEDBACK_ATT_WAS_SET,
|
||||
ucFirst (*name),
|
||||
renderAttribute (*name, after.get (*name)))
|
||||
renderAttribute (*name, after.get (*name), dateformat))
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
|
@ -264,8 +264,8 @@ std::string taskInfoDifferences (const Task& before, const Task& after)
|
|||
else
|
||||
out << format (STRING_FEEDBACK_ATT_WAS_MOD,
|
||||
ucFirst (*name),
|
||||
renderAttribute (*name, before.get (*name)),
|
||||
renderAttribute (*name, after.get (*name)))
|
||||
renderAttribute (*name, before.get (*name), dateformat),
|
||||
renderAttribute (*name, after.get (*name), dateformat))
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ std::string taskInfoDifferences (const Task& before, const Task& after)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string renderAttribute (const std::string& name, const std::string& value)
|
||||
std::string renderAttribute (const std::string& name, const std::string& value, const std::string& format /* = "" */)
|
||||
{
|
||||
Column* col = context.columns[name];
|
||||
if (col &&
|
||||
|
@ -286,7 +286,14 @@ std::string renderAttribute (const std::string& name, const std::string& value)
|
|||
value != "")
|
||||
{
|
||||
Date d ((time_t)strtol (value.c_str (), NULL, 10));
|
||||
return d.toString (context.config.get ("dateformat"));
|
||||
if (format == "")
|
||||
{
|
||||
return d.toString (context.config.get ("dateformat"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return d.toString (format);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue