From 51a4c383d461eb0f7b697864f8412098bcffe95e Mon Sep 17 00:00:00 2001 From: Darren Date: Tue, 2 Oct 2012 15:33:39 +0100 Subject: [PATCH] Common date formatting for less verbose output --- client_backbone/dev/model_application.js | 4 ++-- client_backbone/dev/utils.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client_backbone/dev/model_application.js b/client_backbone/dev/model_application.js index c691417..b344702 100755 --- a/client_backbone/dev/model_application.js +++ b/client_backbone/dev/model_application.js @@ -346,7 +346,7 @@ kiwi.model.Application = Backbone.Model.extend(new (function () { c = that.panels.getByName(event.channel); if (!c) return; - when = new Date(event.when * 1000).toLocaleString(); + when = formatDate(new Date(event.when * 1000)); c.addMsg('', 'Topic set by ' + event.nick + ' at ' + when, 'topic'); }); @@ -497,7 +497,7 @@ kiwi.model.Application = Backbone.Model.extend(new (function () { } else if (event.logon) { logon_date = new Date(); logon_date.setTime(event.logon * 1000); - logon_date = logon_date.toLocaleString(); + logon_date = formateDate(logon_date); panel.addMsg(event.nick, 'idle for ' + idle_time + ', signed on ' + logon_date, 'whois'); } else { diff --git a/client_backbone/dev/utils.js b/client_backbone/dev/utils.js index a62872f..5ba669a 100755 --- a/client_backbone/dev/utils.js +++ b/client_backbone/dev/utils.js @@ -467,6 +467,14 @@ function formatIRCMsg (msg) { +function formatDate (d) { + d = d || new Date(); + return d.toLocaleDateString() + ', ' + d.getHours().toString() + ':' + d.getMinutes().toString() + ':' + d.getSeconds().toString(); +} + + + + -- 2.25.1