From 8c69511b5f978a17f7de185c5ce050664bcd1fef Mon Sep 17 00:00:00 2001 From: Tor Hveem Date: Mon, 7 Oct 2013 00:41:32 +0200 Subject: [PATCH] Improve date handling --- index.html | 2 +- js/websockets.js | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 922bf6a..80e2574 100644 --- a/index.html +++ b/index.html @@ -65,7 +65,7 @@
- {{ bufferline.date }} + {{ bufferline.date | date:'HH:mm' }} diff --git a/js/websockets.js b/js/websockets.js index 8ff9e91..587531b 100644 --- a/js/websockets.js +++ b/js/websockets.js @@ -1,7 +1,3 @@ -Number.prototype.pad = function (len) { - return (new Array(len+1).join("0") + this).slice(-len); -} - var weechat = angular.module('weechat', ['localStorage']); weechat.filter('toArray', function () { 'use strict'; @@ -275,8 +271,6 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($ var handleLine = function(line, initial) { var buffer_line = {} var date = line['date']; - date = new Date(parseInt(date, 10) * 1000); - var datestring = date.getHours().pad(2) + ':' + date.getMinutes().pad(2); var prefix = colors.parse(line['prefix']); var text = colors.parse(line['message']); var buffer = line['buffer']; @@ -309,7 +303,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($ $rootScope.buffers[buffer]['lines'].push(buffer_line); - buffer_line['date'] = datestring; + buffer_line['date'] = date; if(!initial && (highlight || _.contains(tags_array, 'notify_private')) ) { $rootScope.createHighlight(prefix, text, message, buffer, additionalContent);