From a1843097862aacb752a81a7e98231e9d9464a645 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Wed, 1 Jan 2020 11:12:14 -0500 Subject: [PATCH] Fix unwanted localization of integral grouping * Fixes #525 --- include/date/date.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/date/date.h b/include/date/date.h index b6dd7b5..027a5a4 100644 --- a/include/date/date.h +++ b/include/date/date.h @@ -1719,7 +1719,7 @@ operator<<(std::basic_ostream& 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.imbue(std::locale::classic()); os << static_cast(y); if (!y.ok()) os << " is not a valid year"; @@ -2845,6 +2845,7 @@ operator<<(std::basic_ostream& os, const year_month_day& ymd) detail::save_ostream _(os); os.fill('0'); os.flags(std::ios::dec | std::ios::right); + os.imbue(std::locale::classic()); os << ymd.year() << '-'; os.width(2); os << static_cast(ymd.month()) << '-'; @@ -3785,6 +3786,8 @@ public: #else os << '.'; #endif + date::detail::save_ostream _s(os); + os.imbue(std::locale::classic()); os.width(width); os << sub_s_.count(); } @@ -5074,6 +5077,7 @@ to_stream(std::basic_ostream& os, const CharT* fmt, os.setstate(std::ios::failbit); auto const& ymd = fds.ymd; save_ostream _(os); + os.imbue(std::locale::classic()); os.fill('0'); os.flags(std::ios::dec | std::ios::right); os.width(4); @@ -5748,6 +5752,8 @@ to_stream(std::basic_ostream& os, const CharT* fmt, if (modified == CharT{}) #endif { + save_ostream _(os); + os.imbue(std::locale::classic()); os << y; } #if !ONLY_C_LOCALE