aboutsummaryrefslogtreecommitdiff
path: root/lib/render-msg.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/render-msg.js')
-rw-r--r--lib/render-msg.js16
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)
), ' ',