1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

21 lines
391 B
React
Raw Normal View History

2018-07-14 17:48:27 +02:00
import React from 'react'
import moment from 'moment'
window.momnet = moment;
export default class RelativeTimestamp extends React.Component {
render() {
2018-07-27 18:18:48 +02:00
const tsMs = this.props.value / 1000.0 / 1000.0; // nano -> micro -> milli
const now = moment.utc()
const rel = now.subtract(tsMs, 'ms');
2018-07-14 17:48:27 +02:00
return (
<span>{rel.fromNow(this.props.suffix)}</span>
);
}
}