mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Reuse tm_writer in weekday formatter
This commit is contained in:
committed by
Victor Zverovich
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 format(weekday wd, FormatContext& ctx) const -> decltype(ctx.out()) {
|
||||||
auto time = std::tm();
|
auto time = std::tm();
|
||||||
time.tm_wday = static_cast<int>(wd.c_encoding());
|
time.tm_wday = static_cast<int>(wd.c_encoding());
|
||||||
return detail::write<Char>(
|
detail::get_locale loc(localized, ctx.locale());
|
||||||
ctx.out(), time, detail::get_locale(localized, ctx.locale()), 'a');
|
auto w = detail::tm_writer<decltype(ctx.out()), Char>(loc, ctx.out(), time);
|
||||||
|
w.on_abbr_weekday();
|
||||||
|
return w.out();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user