diff --git a/src/lang/english.txt b/src/lang/english.txt index 352119a66a..c5267325c9 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -5521,10 +5521,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helic ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{RAW_STRING}-{RAW_STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:RAW_STRING}-{0:RAW_STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Company {COMMA}) STR_FORMAT_GROUP_NAME :Group {COMMA} diff --git a/src/strings.cpp b/src/strings.cpp index a143d83dee..4fe0304561 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -448,13 +448,8 @@ static char *FormatTinyOrISODate(char *buff, Date date, StringID str, const char YearMonthDay ymd; ConvertDateToYMD(date, &ymd); - char day[3]; - char month[3]; - /* We want to zero-pad the days and months */ - seprintf(day, lastof(day), "%02i", ymd.day); - seprintf(month, lastof(month), "%02i", ymd.month + 1); - - int64 args[] = {(int64)(size_t)day, (int64)(size_t)month, ymd.year}; + /* Day and month are zero-padded with ZEROFILL_NUM, hence the two 2s. */ + int64 args[] = {ymd.day, 2, ymd.month + 1, 2, ymd.year}; StringParameters tmp_params(args); return FormatString(buff, GetStringPtr(str), &tmp_params, last); }