diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index aef8fcc1..0e5382b3 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -2028,6 +2028,7 @@ template struct formatter { template FMT_CONSTEXPR auto do_parse(It begin, It end) -> It { if (begin != end && *begin == ':') ++begin; end = detail::parse_chrono_format(begin, end, detail::tm_format_checker()); + // Replace default spec only if the new spec is not empty. if (end != begin) specs = {begin, detail::to_unsigned(end - begin)}; // basic_string_view<>::compare isn't constexpr before C++17. if (specs.size() == 2 && specs[0] == Char('%')) {