Index: binaries/data/mods/public/gui/common/datetime.js =================================================================== --- /dev/null +++ binaries/data/mods/public/gui/common/datetime.js @@ -0,0 +1,20 @@ +function datetimeToString(datetime, showSeconds = false) +{ + return showSeconds ? + // Translation: Format of the local datetime as shown for example in the load game, save game, and replay menus. + // For a list of symbols that you can use, see: + // http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Field-Symbol-Table + Engine.FormatMillisecondsIntoDateStringLocal(datetime, translateWithContext("datetime, with seconds", "yyyy-MM-dd HH:mm:ss")) : + // Translation: Format of the local datetime as shown for example in the load game, save game, and replay menus. + // For a list of symbols that you can use, see: + // http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Field-Symbol-Table + Engine.FormatMillisecondsIntoDateStringLocal(datetime, translateWithContext("datetime, without seconds", "yyyy-MM-dd HH:mm")); +} + +function monthToString(datetime) +{ + // Translation: Format of the local date (month) as shown for example in the date filter dropdown in the replay menu. + // For a list of symbols that you can use, see: + // http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Field-Symbol-Table + return Engine.FormatMillisecondsIntoDateStringLocal(datetime, translateWithContext("date month", "yyyy-MM")); +} Index: binaries/data/mods/public/gui/common/functions_utility_loadsave.js =================================================================== --- binaries/data/mods/public/gui/common/functions_utility_loadsave.js +++ binaries/data/mods/public/gui/common/functions_utility_loadsave.js @@ -11,9 +11,7 @@ function generateSavegameDateString(metadata, engineInfo) { - return compatibilityColor( - Engine.FormatMillisecondsIntoDateStringLocal(metadata.time * 1000, translate("yyyy-MM-dd HH:mm:ss")), - isCompatibleSavegame(metadata, engineInfo)); + return compatibilityColor(datetimeToString(metadata.time * 1000, true), isCompatibleSavegame(metadata, engineInfo)); } function generateSavegameLabel(metadata, engineInfo) Index: binaries/data/mods/public/gui/replaymenu/replay_menu.js =================================================================== --- binaries/data/mods/public/gui/replaymenu/replay_menu.js +++ binaries/data/mods/public/gui/replaymenu/replay_menu.js @@ -296,7 +296,7 @@ */ function getReplayDateTime(replay) { - return Engine.FormatMillisecondsIntoDateStringLocal(replay.attribs.timestamp * 1000, translate("yyyy-MM-dd HH:mm")); + return datetimeToString(replay.attribs.timestamp * 1000); } /** @@ -320,13 +320,13 @@ } /** - * Returns the month of the given replay in the format "yyyy-MM". + * Returns a human-readable version of the month of the given replay. * * @returns {string} */ function getReplayMonth(replay) { - return Engine.FormatMillisecondsIntoDateStringLocal(replay.attribs.timestamp * 1000, translate("yyyy-MM")); + return monthToString(replay.attribs.timestamp * 1000); } /**