Skip to content

Node.js based forum software built for the modern web

fix: show local time for ban

Barış Soner Uşaklı7a2f0ae15be1
diff --git a/public/src/sockets.js b/public/src/sockets.js
index 24fe64e747..b3bc6795ee 100644
--- a/public/src/sockets.js
+++ b/public/src/sockets.js
@@ -212,15 +212,20 @@ socket = window.socket;
}
function onEventBanned(data) {
- var message = data.until ? '[[error:user-banned-reason-until, ' + utils.toISOString(data.until) + ', ' + data.reason + ']]' : '[[error:user-banned-reason, ' + data.reason + ']]';
-
- bootbox.alert({
- title: '[[error:user-banned]]',
- message: message,
- closeButton: false,
- callback: function () {
- window.location.href = config.relative_path + '/';
- },
+ require(['translator'], function (translator) {
+ var message = data.until ?
+ translator.compile('error:user-banned-reason-until', (new Date(data.until).toLocaleString()), data.reason) :
+ '[[error:user-banned-reason, ' + data.reason + ']]';
+ translator.translate(message, function (message) {
+ bootbox.alert({
+ title: '[[error:user-banned]]',
+ message: message,
+ closeButton: false,
+ callback: function () {
+ window.location.href = config.relative_path + '/';
+ },
+ });
+ });
});
}