mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 21:19:19 +00:00
attack of the monster feeds from the future
This commit is contained in:
parent
6def522f38
commit
a13aea478e
@ -80,14 +80,21 @@ Vue.component('drag', {
|
|||||||
|
|
||||||
function dateRepr(d) {
|
function dateRepr(d) {
|
||||||
var sec = (new Date().getTime() - d.getTime()) / 1000
|
var sec = (new Date().getTime() - d.getTime()) / 1000
|
||||||
|
var neg = sec < 0
|
||||||
|
var out = ''
|
||||||
|
|
||||||
|
sec = Math.abs(sec)
|
||||||
if (sec < 2700) // less than 45 minutes
|
if (sec < 2700) // less than 45 minutes
|
||||||
return Math.round(sec / 60) + 'm'
|
out = Math.round(sec / 60) + 'm'
|
||||||
else if (sec < 86400) // less than 24 hours
|
else if (sec < 86400) // less than 24 hours
|
||||||
return Math.round(sec / 3600) + 'h'
|
out = Math.round(sec / 3600) + 'h'
|
||||||
else if (sec < 604800) // less than a week
|
else if (sec < 604800) // less than a week
|
||||||
return Math.round(sec / 86400) + 'd'
|
out = Math.round(sec / 86400) + 'd'
|
||||||
else
|
else
|
||||||
return d.toLocaleDateString(undefined, {year: "numeric", month: "long", day: "numeric"})
|
out = d.toLocaleDateString(undefined, {year: "numeric", month: "long", day: "numeric"})
|
||||||
|
|
||||||
|
if (neg) return '-' + out
|
||||||
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
Vue.component('relative-time', {
|
Vue.component('relative-time', {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user