Skip to content

Commit

Permalink
Do not use a comma separator for years >= 1000 but < 10000
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrettin committed Nov 17, 2021
1 parent 276e2db commit 3bf5a90
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/util/date_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ namespace wyrmgus::date {

std::string year_to_string(const int year)
{
return number::to_formatted_string(std::abs(year));
const int abs_year = std::abs(year);

if (abs_year < 10000) {
//do not use a formatted string (which can have a comma separator) if the year number is less than 10,000
return std::to_string(abs_year);
}

return number::to_formatted_string(abs_year);
}

}

0 comments on commit 3bf5a90

Please sign in to comment.