-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.js
103 lines (101 loc) · 1.92 KB
/
template.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
"use strict";
var moment = require('moment');
var midNight = moment().startOf('day').unix();
var midYear = moment().startOf('year').unix();
var template = {
weibo: [
{
limit: '10',
rightString: '10秒前'
},
{
above: '10',
limit: '60',
unit: 'second',
rightString: '秒前'
},
{
above: '60',
limit: '3600',
unit: 'minute',
rightString: '分钟前'
},
{
above: '3600',
limit: moment().unix() - midNight,
unit: 'HH:mm',
leftString: '今天'
},
{
limit: moment().unix() - midYear,
above: moment().unix() - midNight,
unit: 'MMM Do HH:mm'
},
{
above: moment().unix() - midYear,
unit: 'YYYY-MM-DD HH:mm'
}
],
weiboMobile: [
{
limit: '10',
rightString: '10秒前'
},
{
above: '10',
limit: '60',
unit: 'second',
rightString: '秒前'
},
{
above: '60',
limit: '3600',
unit: 'minute',
rightString: '分钟前'
},
{
above: '3600',
limit: moment().unix() - midNight,
unit: 'HH:mm',
leftString: '今天'
},
{
above: moment().unix() - midNight,
limit: moment().unix() - midNight + 86400,
unit: 'HH:mm',
leftString: '昨天'
},
{
limit: moment().unix() - midYear,
above: moment().unix() - midNight + 86400,
unit: 'M-D'
},
{
above: moment().unix() - midYear,
unit: 'YY-MM-DD'
}
],
wechat: [{
limit: '60',
rightString: '1分钟前'
},
{
above: '60',
limit: '3600',
unit: 'minute',
rightString: '分钟前'
},
{
above: '3600',
limit: moment().unix() - midNight,
unit: 'hour',
rightString: '小时前'
},
{
above: moment().unix() - midNight,
unit: 'date',
rightString: '天前'
}
]
};
module.exports = template;