git ssb

0+

ev / microbay



forked from Dominic / patchbay

Tree: b8c0ac9c32b89a9bd44ff026a5f5c5cd4368ffbe

Files: b8c0ac9c32b89a9bd44ff026a5f5c5cd4368ffbe / modules / timestamp.js

509 bytesRaw
1var h = require('hyperscript')
2var moment = require('moment')
3
4function updateTimestampEl(el) {
5 el.firstChild.nodeValue = el.timestamp.fromNow()
6 return el
7}
8
9setInterval(function () {
10 var els = [].slice.call(document.querySelectorAll('.timestamp'))
11 els.forEach(updateTimestampEl)
12}, 60e3)
13
14exports.message_meta = function (msg) {
15 var m = moment(msg.value.timestamp)
16 return updateTimestampEl(h('a.enter.timestamp', {
17 href: '#'+msg.key,
18 timestamp: m,
19 title: m.format('LLLL')
20 }, ''))
21}
22

Built with git-ssb-web