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:
@@ -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")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user