some docs
This commit is contained in:
parent
55819ebfe0
commit
c9ea3821b6
7 changed files with 342 additions and 244 deletions
|
@ -11,17 +11,12 @@ namespace {
|
|||
|
||||
const year_month_day ymd = year_month_day { floor<days>(system_clock::now()) };
|
||||
|
||||
String month = std::format("{:%B}", ymd);
|
||||
|
||||
u32 day = static_cast<u32>(ymd.day());
|
||||
|
||||
CStr suffix = day >= 11 && day <= 13 ? "th"
|
||||
: day % 10 == 1 ? "st"
|
||||
: day % 10 == 2 ? "nd"
|
||||
: day % 10 == 3 ? "rd"
|
||||
: "th";
|
||||
|
||||
return std::format("{} {}{}", month, day, suffix);
|
||||
try {
|
||||
return std::format(std::locale(""), "{:%B %d}", ymd);
|
||||
} catch (const std::runtime_error& e) {
|
||||
ERROR_LOG("Warning: Could not retrieve or use system locale ({}). Falling back to default C locale.", e.what());
|
||||
return std::format(std::locale::classic(), "{:%B %d}", ymd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue