mirror of
https://github.com/alice-lg/alice-lg.git
synced 2024-05-11 05:55:03 +00:00
17 lines
364 B
JavaScript
17 lines
364 B
JavaScript
|
|
import React from 'react'
|
|
import moment from 'moment'
|
|
|
|
export default class RelativeTimestamp extends React.Component {
|
|
render() {
|
|
const tsMs = this.props.value / 1000.0 / 1000.0; // nano -> micro -> milli
|
|
const now = moment.utc()
|
|
const rel = now.subtract(tsMs, 'ms');
|
|
|
|
return (
|
|
<span>{rel.fromNow(this.props.suffix)}</span>
|
|
);
|
|
}
|
|
}
|
|
|