1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:07:36 +00:00

LibJS: Convert StringBuilder::appendf() => AK::Format

This commit is contained in:
Andreas Kling 2021-05-07 11:51:57 +02:00
parent e76956f712
commit 72259d5cee

View file

@ -87,23 +87,23 @@ String Date::iso_date_string() const
StringBuilder builder; StringBuilder builder;
if (year < 0) if (year < 0)
builder.appendf("-%06d", -year); builder.appendff("-{:06}", -year);
else if (year > 9999) else if (year > 9999)
builder.appendf("+%06d", year); builder.appendff("+{:06}", year);
else else
builder.appendf("%04d", year); builder.appendff("{:04}", year);
builder.append('-'); builder.append('-');
builder.appendf("%02d", month); builder.appendff("{:02}", month);
builder.append('-'); builder.append('-');
builder.appendf("%02d", tm.tm_mday); builder.appendff("{:02}", tm.tm_mday);
builder.append('T'); builder.append('T');
builder.appendf("%02d", tm.tm_hour); builder.appendff("{:02}", tm.tm_hour);
builder.append(':'); builder.append(':');
builder.appendf("%02d", tm.tm_min); builder.appendff("{:02}", tm.tm_min);
builder.append(':'); builder.append(':');
builder.appendf("%02d", tm.tm_sec); builder.appendff("{:02}", tm.tm_sec);
builder.append('.'); builder.append('.');
builder.appendf("%03d", m_milliseconds); builder.appendff("{:03}", m_milliseconds);
builder.append('Z'); builder.append('Z');
return builder.build(); return builder.build();