File tree 2 files changed +6
-11
lines changed
2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -2150,7 +2150,7 @@ template <typename Char> struct formatter<month, Char> {
2150
2150
template <typename FormatContext>
2151
2151
auto format (month m, FormatContext& ctx) const -> decltype(ctx.out()) {
2152
2152
auto time = std::tm ();
2153
- // std::chrono::month has a range of 1-12, std::tm requires 0-11
2153
+ // std::chrono::month has a range of 1-12, std::tm requires 0-11.
2154
2154
time .tm_mon = static_cast <int >(static_cast <unsigned >(m)) - 1 ;
2155
2155
detail::get_locale loc (localized, ctx.locale ());
2156
2156
auto w = detail::tm_writer<decltype (ctx.out ()), Char>(loc, ctx.out (), time );
@@ -2168,7 +2168,7 @@ template <typename Char> struct formatter<year, Char> {
2168
2168
template <typename FormatContext>
2169
2169
auto format (year y, FormatContext& ctx) const -> decltype(ctx.out()) {
2170
2170
auto time = std::tm ();
2171
- // std::tm::tm_year is years since 1900
2171
+ // std::tm::tm_year is years since 1900.
2172
2172
time .tm_year = static_cast <int >(y) - 1900 ;
2173
2173
detail::get_locale loc (true , ctx.locale ());
2174
2174
auto w = detail::tm_writer<decltype (ctx.out ()), Char>(loc, ctx.out (), time );
Original file line number Diff line number Diff line change @@ -1014,13 +1014,8 @@ TEST(chrono_test, out_of_range) {
1014
1014
}
1015
1015
1016
1016
TEST (chrono_test, year_month_day) {
1017
- auto loc = get_locale (" es_ES.UTF-8" );
1018
- std::locale::global (loc);
1019
- auto year = fmt::year (2024 );
1020
- auto month = fmt::month (1 );
1021
- auto day = fmt::day (1 );
1022
-
1023
- EXPECT_EQ (fmt::format (" {}" , year), " 2024" );
1024
- EXPECT_EQ (fmt::format (" {}" , month), " Jan" );
1025
- EXPECT_EQ (fmt::format (" {}" , day), " 01" );
1017
+ std::locale::global (get_locale (" es_ES.UTF-8" ));
1018
+ EXPECT_EQ (fmt::format (" {}" , fmt::year (2024 )), " 2024" );
1019
+ EXPECT_EQ (fmt::format (" {}" , fmt::month (1 )), " Jan" );
1020
+ EXPECT_EQ (fmt::format (" {}" , fmt::day (1 )), " 01" );
1026
1021
}
You can’t perform that action at this time.
0 commit comments