From 0137a295d2cf9c659a360eca278d25d3f2f1b207 Mon Sep 17 00:00:00 2001 From: cel Date: Mon, 14 Jan 2019 09:36:36 -1000 Subject: Don't show zero timestamps --- lib/render-msg.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib/render-msg.js') diff --git a/lib/render-msg.js b/lib/render-msg.js index 329a942..26604c3 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -107,7 +107,8 @@ RenderMsg.prototype.raw = function (cb) { RenderMsg.prototype.wrap = function (content, cb) { if (!this.shouldWrap) return cb(null, content) - var date = new Date(this.msg.value.timestamp) + var ts = this.msg.value.timestamp + var date = ts ? new Date(ts) : null var self = this var channel = this.c.channel ? '#' + this.c.channel : '' var done = multicb({pluck: 1, spread: true}) @@ -119,10 +120,10 @@ RenderMsg.prototype.wrap = function (content, cb) { ), h('td.msg-main', h('div.msg-header', - h('a.ssb-timestamp', { + date ? [h('a.ssb-timestamp', { title: date.toLocaleString(), href: this.msg.key ? this.toUrl(this.msg.key) : undefined - }, htime(date)), ' ', + }, htime(date)), ' '] : '', h('code', h('a.ssb-id', { href: this.toUrl(this.msg.key) + (this.hasFullLink && this.opts.full ? '?full' : '') @@ -139,7 +140,8 @@ RenderMsg.prototype.wrap = function (content, cb) { RenderMsg.prototype.wrapMini = function (content, cb) { if (!this.shouldWrap) return cb(null, content) - var date = new Date(this.value.timestamp) + var ts = this.value.timestamp + var date = ts ? new Date(ts) : nulll var self = this var channel = this.c.channel ? '#' + this.c.channel : '' var done = multicb({pluck: 1, spread: true}) @@ -149,10 +151,10 @@ RenderMsg.prototype.wrapMini = function (content, cb) { this.recpsLine(done()), channel ? [h('a', {href: this.toUrl(channel)}, channel), ' '] : ''), h('td.msg-main', - h('a.ssb-timestamp', { + date ? [h('a.ssb-timestamp', { title: date.toLocaleString(), href: this.msg.key ? this.toUrl(this.msg.key) : undefined - }, htime(date)), ' ', + }, htime(date)), ' '] : '', this.issues(done()), content), h('td.msg-right', this.actions(true)) @@ -1834,7 +1836,7 @@ RenderMsg.prototype.lineComment = function (cb) { h('a', { href: self.toUrl(self.c.updateId) }, - updateMsg + updateMsg && updateMsg.value.timestamp ? htime(new Date(updateMsg.value.timestamp)) : String(self.c.updateId) ), ' ', -- cgit v1.2.3