Improve date handling

This commit is contained in:
Tor Hveem 2013-10-07 00:41:32 +02:00
parent 452fc3adfa
commit 8c69511b5f
2 changed files with 2 additions and 8 deletions

View file

@ -65,7 +65,7 @@
</ul>
<div class="bufferlines" ng-repeat="bufferline in activeBuffer.lines">
<span class="date text-muted">
{{ bufferline.date }}
{{ bufferline.date | date:'HH:mm' }}
</span>
<span ng-repeat="part in bufferline.message" class="text" style="{{ part.fg }}">

View file

@ -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);