Fix operator<< for years with non C locale

Fix the issue https://github.com/HowardHinnant/date/issues/392
This commit is contained in:
AdrienBellanger
2018-11-01 15:07:20 +01:00
committed by Howard Hinnant
parent 6f0b645df1
commit 09d90a8b5e

View File

@ -1722,6 +1722,7 @@ operator<<(std::basic_ostream<CharT, Traits>& os, const year& y)
os.fill('0');
os.flags(std::ios::dec | std::ios::internal);
os.width(4 + (y < year{0}));
os.imbue(std::locale::classic());
os << static_cast<int>(y);
if (!y.ok())
os << " is not a valid year";