mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-30 02:17:21 +02:00
Report date format
- added new reportdateformat to extend the formatting of due dates in the reports and "task info" - added new conversion sequences a, A, b, B and Y to be used with reportdateformat
This commit is contained in:
parent
e92fb9287a
commit
660d0cca3e
14 changed files with 269 additions and 52 deletions
|
@ -412,7 +412,7 @@ int handleInfo (std::string &outs)
|
|||
table.addCell (row, 0, "Due");
|
||||
|
||||
Date dt (atoi (task->get ("due").c_str ()));
|
||||
std::string due = getDueDate (*task);
|
||||
std::string due = getDueDate (*task, context.config.get("reportdateformat", context.config.get("dateformat","m/d/Y")));
|
||||
table.addCell (row, 1, due);
|
||||
|
||||
overdue = (dt < now) ? true : false;
|
||||
|
@ -1218,7 +1218,7 @@ int handleReportTimesheet (std::string &outs)
|
|||
{
|
||||
int row = completed.addRow ();
|
||||
completed.addCell (row, 1, task->get ("project"));
|
||||
completed.addCell (row, 2, getDueDate (*task));
|
||||
completed.addCell (row, 2, getDueDate (*task,context.config.get("dateformat","m/d/Y")));
|
||||
completed.addCell (row, 3, getFullDescription (*task));
|
||||
|
||||
if (color)
|
||||
|
@ -1274,7 +1274,7 @@ int handleReportTimesheet (std::string &outs)
|
|||
{
|
||||
int row = started.addRow ();
|
||||
started.addCell (row, 1, task->get ("project"));
|
||||
started.addCell (row, 2, getDueDate (*task));
|
||||
started.addCell (row, 2, getDueDate (*task,context.config.get("dateformat","m/d/Y")));
|
||||
started.addCell (row, 3, getFullDescription (*task));
|
||||
|
||||
if (color)
|
||||
|
@ -2124,13 +2124,15 @@ std::string getFullDescription (Task& task)
|
|||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
std::string getDueDate (Task& task)
|
||||
std::string getDueDate (Task& task, const std::string& format)
|
||||
{
|
||||
std::string due = task.get ("due");
|
||||
if (due.length ())
|
||||
{
|
||||
Date d (atoi (due.c_str ()));
|
||||
due = d.toString (context.config.get ("dateformat", "m/d/Y"));
|
||||
due = d.toString (format);
|
||||
//due = d.toString (context.config.get ("dateformat", "m/d/Y"));
|
||||
//due = d.toString (context.config.get ("reportdateformat", context.config.get ("dateformat", "m/d/Y")));
|
||||
}
|
||||
|
||||
return due;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue