From 0e08b942c80f7beedea78af5e834ae37da40555e Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Thu, 11 Mar 2021 19:18:01 -0500 Subject: [PATCH] Correct the streaming output of year_month_day * Invalid dates were printing out "invalid" too many times. --- include/date/date.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/date/date.h b/include/date/date.h index 73e95dc..7519bb8 100644 --- a/include/date/date.h +++ b/include/date/date.h @@ -2889,10 +2889,11 @@ operator<<(std::basic_ostream& os, const year_month_day& ymd) os.fill('0'); os.flags(std::ios::dec | std::ios::right); os.imbue(std::locale::classic()); - os << ymd.year() << '-'; + os << static_cast(ymd.year()) << '-'; os.width(2); os << static_cast(ymd.month()) << '-'; - os << ymd.day(); + os.width(2); + os << static_cast(ymd.day()); if (!ymd.ok()) os << " is not a valid date"; return os;