git ssb

0+

ev / microbay



forked from Dominic / patchbay

Commit f7ca54c0c9db01f4eb92a59c6b61eda900f89e9f

avoid moment, which is surprisingly large!

Dominic Tarr committed on 7/30/2016, 3:30:58 AM
Parent: 1db0c00d5c1029322455ac21c2ef002f981fa59c

Files changed

modules/git.jschanged
modules/timestamp.jschanged
modules/git.jsView
@@ -1,8 +1,8 @@
11 var h = require('hyperscript')
22 var pull = require('pull-stream')
33 var paramap = require('pull-paramap')
4-var moment = require('moment')
4+var human = require('human-time')
55
66 var plugs = require('../plugs')
77 var message_link = plugs.first(exports.message_link = [])
88 var sbot_links = plugs.first(exports.sbot_links = [])
@@ -59,13 +59,14 @@
5959 })
6060 )
6161 }
6262
63+//todo:
6364 function messageTimestampLink(msg) {
64- var m = moment(msg.value.timestamp)
65+ var m = human(msg.value.timestamp)
6566 return h('a.timestamp', {
66- timestamp: m,
67- title: m.format('LLLL'),
67+ timestamp: msg.value.timestamp,
68+ title: new Date(msg.value.timestamp),
6869 href: '#'+msg.key
6970 }, m.fromNow())
7071 }
7172
@@ -247,4 +248,5 @@
247248 })
248249 return el
249250 }
250251 }
252+
modules/timestamp.jsView
@@ -1,9 +1,9 @@
11 var h = require('hyperscript')
2-var moment = require('moment')
2+var human = require('human-time')
33
44 function updateTimestampEl(el) {
5- el.firstChild.nodeValue = el.timestamp.fromNow()
5+ el.firstChild.nodeValue = human(new Date(el.timestamp))
66 return el
77 }
88
99 setInterval(function () {
@@ -11,11 +11,11 @@
1111 els.forEach(updateTimestampEl)
1212 }, 60e3)
1313
1414 exports.message_meta = function (msg) {
15- var m = moment(msg.value.timestamp)
1615 return updateTimestampEl(h('a.enter.timestamp', {
1716 href: '#'+msg.key,
18- timestamp: m,
19- title: m.format('LLLL')
17+ timestamp: msg.value.timestamp,
18+ title: new Date(msg.value.timestamp)
2019 }, ''))
2120 }
21+

Built with git-ssb-web