1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:37:45 +00:00

LibCore: Add %l conversion specification to DateTime

Replaced by the hour as a decimal 1-12 in which single digits
are preceded by a blank
This commit is contained in:
thankyouverycool 2022-11-27 06:42:06 -05:00 committed by Andreas Kling
parent 5c68ca8f48
commit 63d0aa9d8a

View file

@ -163,6 +163,13 @@ String DateTime::to_string(StringView format) const
case 'j':
builder.appendff("{:03}", tm.tm_yday + 1);
break;
case 'l': {
int display_hour = tm.tm_hour % 12;
if (display_hour == 0)
display_hour = 12;
builder.appendff("{:2}", display_hour);
break;
}
case 'm':
builder.appendff("{:02}", tm.tm_mon + 1);
break;