mirror of
https://github.com/HowardHinnant/date.git
synced 2025-07-31 19:24:28 +02:00
Fix operator<< for years with non C locale
Fix the issue https://github.com/HowardHinnant/date/issues/392
This commit is contained in:
committed by
Howard Hinnant
parent
6f0b645df1
commit
09d90a8b5e
@@ -1722,6 +1722,7 @@ operator<<(std::basic_ostream<CharT, Traits>& os, const year& y)
|
|||||||
os.fill('0');
|
os.fill('0');
|
||||||
os.flags(std::ios::dec | std::ios::internal);
|
os.flags(std::ios::dec | std::ios::internal);
|
||||||
os.width(4 + (y < year{0}));
|
os.width(4 + (y < year{0}));
|
||||||
|
os.imbue(std::locale::classic());
|
||||||
os << static_cast<int>(y);
|
os << static_cast<int>(y);
|
||||||
if (!y.ok())
|
if (!y.ok())
|
||||||
os << " is not a valid year";
|
os << " is not a valid year";
|
||||||
|
Reference in New Issue
Block a user