From 8a7270728c65c976f2c7f95e4f857a767f23b1d1 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 25 Apr 2017 18:29:46 +0200 Subject: [PATCH] Added support for JS date format escape sequences --- com.woltlab.wcf/templates/headIncludeJavaScript.tpl | 2 +- wcfsetup/install/files/acp/templates/header.tpl | 2 +- wcfsetup/install/files/js/WoltLabSuite/Core/Date/Util.js | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl index 7dfb376b97..78879e4600 100644 --- a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl +++ b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl @@ -41,7 +41,7 @@ requirejs.config({ 'wcf.date.relative.minutes': '{capture assign=relativeMinutes}{lang __literal=true}wcf.date.relative.minutes{/lang}{/capture}{@$relativeMinutes|encodeJS}', 'wcf.date.relative.hours': '{capture assign=relativeHours}{lang __literal=true}wcf.date.relative.hours{/lang}{/capture}{@$relativeHours|encodeJS}', 'wcf.date.relative.pastDays': '{capture assign=relativePastDays}{lang __literal=true}wcf.date.relative.pastDays{/lang}{/capture}{@$relativePastDays|encodeJS}', - 'wcf.date.dateFormat': '{lang}wcf.date.dateFormat{/lang}', + 'wcf.date.dateFormat': '{"wcf.date.dateFormat"|language|encodeJS}', 'wcf.date.dateTimeFormat': '{lang}wcf.date.dateTimeFormat{/lang}', 'wcf.date.shortDateTimeFormat': '{lang}wcf.date.shortDateTimeFormat{/lang}', 'wcf.date.hour': '{lang}wcf.date.hour{/lang}', diff --git a/wcfsetup/install/files/acp/templates/header.tpl b/wcfsetup/install/files/acp/templates/header.tpl index f2c00c3688..692de842d1 100644 --- a/wcfsetup/install/files/acp/templates/header.tpl +++ b/wcfsetup/install/files/acp/templates/header.tpl @@ -55,7 +55,7 @@ 'wcf.date.relative.minutes': '{capture assign=relativeMinutes}{lang __literal=true}wcf.date.relative.minutes{/lang}{/capture}{@$relativeMinutes|encodeJS}', 'wcf.date.relative.hours': '{capture assign=relativeHours}{lang __literal=true}wcf.date.relative.hours{/lang}{/capture}{@$relativeHours|encodeJS}', 'wcf.date.relative.pastDays': '{capture assign=relativePastDays}{lang __literal=true}wcf.date.relative.pastDays{/lang}{/capture}{@$relativePastDays|encodeJS}', - 'wcf.date.dateFormat': '{lang}wcf.date.dateFormat{/lang}', + 'wcf.date.dateFormat': '{"wcf.date.dateFormat"|language|encodeJS}', 'wcf.date.dateTimeFormat': '{lang}wcf.date.dateTimeFormat{/lang}', 'wcf.date.shortDateTimeFormat': '{lang}wcf.date.shortDateTimeFormat{/lang}', 'wcf.date.hour': '{lang}wcf.date.hour{/lang}', diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Date/Util.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Date/Util.js index aac63811eb..5447d74014 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Date/Util.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Date/Util.js @@ -179,6 +179,14 @@ define(['Language'], function(Language) { case 'U': char = Math.round(date.getTime() / 1000); break; + + // escape sequence + case '\\': + char = ''; + if (i + 1 < length) { + char = format[++i]; + } + break; default: char = format[i]; -- 2.20.1