Repository: fmtlib/fmt
File: include/fmt/chrono.h (C/C++)

Code before:
      {'M', 'o', 'n', 'd', 'a', 'y', '\0', '\0', '\0', '\0'},
      {'T', 'u', 'e', 's', 'd', 'a', 'y', '\0', '\0', '\0'},
      {'W', 'e', 'd', 'n', 'e', 's', 'd', 'a', 'y', '\0'},
      {'T', 'h', 'u', 'r', 's', 'd', 'a', 'y', '\0', '\0'},
      {'F', 'r', 'i', 'd', 'a', 'y', '\0', '\0', '\0', '\0'},
      {'S', 'a', 't', 'u', 'r', 'd', 'a', 'y', '\0', '\0'}};
  static constexpr const Char month[][10] = {
      {'J', 'a', 'n', 'u', 'a', 'r', 'y', '\0', '\0', '\0'},
      {'F', 'e', 'b', 'r', 'u', 'a', 'r', 'y', '\0', '\0'},
      {'M', 'a', 'r', 'c', 'h', '\0', '\0', '\0', '\0', '\0'},
      {'A', 'p', 'r', 'i', 'l', '\0', '\0', '\0', '\0', '\0'},
      {'M', 'a', 'y', '\0', '\0', '\0', '\0', '\0', '\0', '\0'},
      {'J', 'u', 'n', 'e', '\0', '\0', '\0', '\0', '\0', '\0'},
      {'J', 'u', 'l', 'y', '\0', '\0', '\0', '\0', '\0', '\0'},
      {'A', 'u', 'g', 'u', 's', 't', '\0', '\0', '\0', '\0'},
      {'S', 'e', 'p', 't', 'e', 'm', 'b', 'e', 'r', '\0'},
      {'O', 'c', 't', 'o', 'b', 'e', 'r', '\0', '\0', '\0'},
      {'N', 'o', 'v', 'e', 'm', 'b', 'e', 'r', '\0', '\0'},
      {'D', 'e', 'c', 'e', 'm', 'b', 'e', 'r', '\0', '\0'}};

  const std::locale& loc_;
  const bool is_classic_;
  OutputIt out_;
  const std::tm& tm_;

  auto tm_sec() const noexcept -> unsigned {
    FMT_ASSERT(tm_.tm_sec >= 0 && tm_.tm_sec <= 60,
               "tm_sec not in range [0, 60]");
    return to_unsigned(tm_.tm_sec);
  }
  auto tm_min() const noexcept -> unsigned {
    FMT_ASSERT(tm_.tm_min >= 0 && tm_.tm_min <= 59,
               "tm_min not in range [0, 59]");
    return to_unsigned(tm_.tm_min);
  }
  auto tm_hour() const noexcept -> unsigned {
    FMT_ASSERT(tm_.tm_hour >= 0 && tm_.tm_hour <= 23,
               "tm_hour not in range [0, 23]");
    return to_unsigned(tm_.tm_hour);
  }
  auto tm_mday() const noexcept -> unsigned {
    FMT_ASSERT(tm_.tm_mday >= 1 && tm_.tm_mday <= 31,
               "tm_mday not in range [1, 31]");
    return to_unsigned(tm_.tm_mday);
  }
  auto tm_mon() const noexcept -> unsigned {
    FMT_ASSERT(tm_.tm_mon >= 0 && tm_.tm_mon <= 11,
               "tm_mon not in range [0, 11]");
    return to_unsigned(tm_.tm_mon);
  }
  auto tm_year() const noexcept -> long long {

Review comment (suggestion):
Let's keep `int` as a return type here and elsewhere.

Code after:
  static constexpr const char* short_name_list[] = {"Sun", "Mon", "Tue", "Wed",
                                                    "Thu", "Fri", "Sat"};
  return wday >= 0 && wday <= 6 ? short_name_list[wday] : "???";
}

inline const char* tm_mon_full_name(int mon) {
  static constexpr const char* full_name_list[] = {
      "January", "February", "March",     "April",   "May",      "June",
      "July",    "August",   "September", "October", "November", "December"};
  return mon >= 0 && mon <= 11 ? full_name_list[mon] : "?";
}
inline const char* tm_mon_short_name(int mon) {
  static constexpr const char* short_name_list[] = {
      "Jan", "Feb", "Mar", "Apr", "May", "Jun",
      "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
  };
  return mon >= 0 && mon <= 11 ? short_name_list[mon] : "???";
}

template <typename OutputIt, typename Char> class tm_writer {
 private:
  static constexpr int days_per_week = 7;

  const std::locale& loc_;
  const bool is_classic_;
  OutputIt out_;
  const std::tm& tm_;

  auto tm_sec() const noexcept -> int {
    FMT_ASSERT(tm_.tm_sec >= 0 && tm_.tm_sec <= 61, "");
    return tm_.tm_sec;
  }
  auto tm_min() const noexcept -> int {
    FMT_ASSERT(tm_.tm_min >= 0 && tm_.tm_min <= 59, "");
    return tm_.tm_min;
  }
  auto tm_hour() const noexcept -> int {
    FMT_ASSERT(tm_.tm_hour >= 0 && tm_.tm_hour <= 23, "");
    return tm_.tm_hour;
  }
  auto tm_mday() const noexcept -> int {
    FMT_ASSERT(tm_.tm_mday >= 1 && tm_.tm_mday <= 31, "");
    return tm_.tm_mday;
  }
  auto tm_mon() const noexcept -> int {
    FMT_ASSERT(tm_.tm_mon >= 0 && tm_.tm_mon <= 11, "");
    return tm_.tm_mon;
  }
  auto tm_year() const noexcept -> long long { return 1900ll + tm_.tm_year; }
  auto tm_wday() const noexcept -> int {
    FMT_ASSERT(tm_.tm_wday >= 0 && tm_.tm_wday <= 6, "");