diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-01-14 09:36:36 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-01-14 09:36:36 -1000 |
commit | 0137a295d2cf9c659a360eca278d25d3f2f1b207 (patch) | |
tree | c1ea83ff30f872ca764fedeb557d979596e74740 | |
parent | 0da3e21c2cba5bdc6fc78087845c68e52cf6168e (diff) | |
download | patchfoo-0137a295d2cf9c659a360eca278d25d3f2f1b207.tar.gz patchfoo-0137a295d2cf9c659a360eca278d25d3f2f1b207.zip |
Don't show zero timestamps
-rw-r--r-- | lib/render-msg.js | 16 |
1 files changed, 9 insertions, 7 deletions
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) ), ' ', |