From 43f58a80752d3589b836ec987c560114a154ef42 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 20 Mar 2016 19:18:43 +0200 Subject: [PATCH] Format topic set date --- client/js/libs/handlebars/date.js | 7 +++++++ client/views/actions/topic_set_by.tpl | 2 +- src/plugins/irc-events/topic.js | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 client/js/libs/handlebars/date.js diff --git a/client/js/libs/handlebars/date.js b/client/js/libs/handlebars/date.js new file mode 100644 index 00000000..751e713d --- /dev/null +++ b/client/js/libs/handlebars/date.js @@ -0,0 +1,7 @@ +Handlebars.registerHelper( + "localeDate", function(date) { + date = new Date(date); + + return date.toLocaleString(); + } +); diff --git a/client/views/actions/topic_set_by.tpl b/client/views/actions/topic_set_by.tpl index 87d8ee83..d842fa67 100644 --- a/client/views/actions/topic_set_by.tpl +++ b/client/views/actions/topic_set_by.tpl @@ -1 +1 @@ -Topic set by {{nick}} on {{when}} +Topic set by {{nick}} on {{localeDate when}} diff --git a/src/plugins/irc-events/topic.js b/src/plugins/irc-events/topic.js index be63c451..f341fcd7 100644 --- a/src/plugins/irc-events/topic.js +++ b/src/plugins/irc-events/topic.js @@ -39,7 +39,7 @@ module.exports = function(irc, network) { type: Msg.Type.TOPIC_SET_BY, mode: chan.getMode(data.nick), nick: data.nick, - when: data.when, + when: new Date(data.when * 1000), self: data.nick === irc.user.nick }); chan.messages.push(msg);