mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-04 17:40:35 +00:00
Reuse tm_writer in weekday formatter
This commit is contained in:
parent
8b89454994
commit
50140be7ae
@ -1663,8 +1663,10 @@ template <typename Char> struct formatter<weekday, Char> {
|
||||
auto format(weekday wd, FormatContext& ctx) const -> decltype(ctx.out()) {
|
||||
auto time = std::tm();
|
||||
time.tm_wday = static_cast<int>(wd.c_encoding());
|
||||
return detail::write<Char>(
|
||||
ctx.out(), time, detail::get_locale(localized, ctx.locale()), 'a');
|
||||
detail::get_locale loc(localized, ctx.locale());
|
||||
auto w = detail::tm_writer<decltype(ctx.out()), Char>(loc, ctx.out(), time);
|
||||
w.on_abbr_weekday();
|
||||
return w.out();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user