Commit f7ca54c0c9db01f4eb92a59c6b61eda900f89e9f
avoid moment, which is surprisingly large!
Dominic Tarr committed on 7/30/2016, 3:30:58 AMParent: 1db0c00d5c1029322455ac21c2ef002f981fa59c
Files changed
modules/git.js | changed |
modules/timestamp.js | changed |
modules/git.js | ||
---|---|---|
@@ -1,8 +1,8 @@ | ||
1 | 1 | var h = require('hyperscript') |
2 | 2 | var pull = require('pull-stream') |
3 | 3 | var paramap = require('pull-paramap') |
4 | -var moment = require('moment') | |
4 | +var human = require('human-time') | |
5 | 5 | |
6 | 6 | var plugs = require('../plugs') |
7 | 7 | var message_link = plugs.first(exports.message_link = []) |
8 | 8 | var sbot_links = plugs.first(exports.sbot_links = []) |
@@ -59,13 +59,14 @@ | ||
59 | 59 | }) |
60 | 60 | ) |
61 | 61 | } |
62 | 62 | |
63 | +//todo: | |
63 | 64 | function messageTimestampLink(msg) { |
64 | - var m = moment(msg.value.timestamp) | |
65 | + var m = human(msg.value.timestamp) | |
65 | 66 | return h('a.timestamp', { |
66 | - timestamp: m, | |
67 | - title: m.format('LLLL'), | |
67 | + timestamp: msg.value.timestamp, | |
68 | + title: new Date(msg.value.timestamp), | |
68 | 69 | href: '#'+msg.key |
69 | 70 | }, m.fromNow()) |
70 | 71 | } |
71 | 72 | |
@@ -247,4 +248,5 @@ | ||
247 | 248 | }) |
248 | 249 | return el |
249 | 250 | } |
250 | 251 | } |
252 | + |
modules/timestamp.js | ||
---|---|---|
@@ -1,9 +1,9 @@ | ||
1 | 1 | var h = require('hyperscript') |
2 | -var moment = require('moment') | |
2 | +var human = require('human-time') | |
3 | 3 | |
4 | 4 | function updateTimestampEl(el) { |
5 | - el.firstChild.nodeValue = el.timestamp.fromNow() | |
5 | + el.firstChild.nodeValue = human(new Date(el.timestamp)) | |
6 | 6 | return el |
7 | 7 | } |
8 | 8 | |
9 | 9 | setInterval(function () { |
@@ -11,11 +11,11 @@ | ||
11 | 11 | els.forEach(updateTimestampEl) |
12 | 12 | }, 60e3) |
13 | 13 | |
14 | 14 | exports.message_meta = function (msg) { |
15 | - var m = moment(msg.value.timestamp) | |
16 | 15 | return updateTimestampEl(h('a.enter.timestamp', { |
17 | 16 | href: '#'+msg.key, |
18 | - timestamp: m, | |
19 | - title: m.format('LLLL') | |
17 | + timestamp: msg.value.timestamp, | |
18 | + title: new Date(msg.value.timestamp) | |
20 | 19 | }, '')) |
21 | 20 | } |
21 | + |
Built with git-ssb-web