mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-06 17:37:21 +02:00
Date Formatting
- Some bad inefficiencies in date formatting were noticed, and when addressed, caused a bug to surface. The length of a formatted date can be calculated from the dateformat, but was done incorrectly. Very, very incorrectly. - Added unit tests. - Promoted date column-specific "countdown" size measurements up to the ColDate base class. This neatly falls out from work on #1218. - Noted a potential I18N problem in Date.cpp.
This commit is contained in:
parent
d895c4a249
commit
656e350291
8 changed files with 79 additions and 122 deletions
|
@ -92,7 +92,7 @@ void ColumnUDA::measure (Task& task, unsigned int& minimum, unsigned int& maximu
|
|||
// Determine the output date format, which uses a hierarchy of definitions.
|
||||
// rc.report.<report>.dateformat
|
||||
// rc.dateformat.report
|
||||
// rc.dateformat.
|
||||
// rc.dateformat
|
||||
Date date ((time_t) strtol (value.c_str (), NULL, 10));
|
||||
std::string format = context.config.get ("report." + _report + ".dateformat");
|
||||
if (format == "")
|
||||
|
@ -100,7 +100,7 @@ void ColumnUDA::measure (Task& task, unsigned int& minimum, unsigned int& maximu
|
|||
if (format == "")
|
||||
format = context.config.get ("dateformat");
|
||||
|
||||
minimum = maximum = utf8_width (date.toString (format));
|
||||
minimum = maximum = Date::length (format);
|
||||
}
|
||||
else if (_type == "duration")
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue