mirror of
https://github.com/alice-lg/alice-lg.git
synced 2024-05-11 05:55:03 +00:00
21 lines
347 B
JavaScript
21 lines
347 B
JavaScript
|
|
import React from 'react'
|
|
import moment from 'moment'
|
|
|
|
|
|
window.momnet = moment;
|
|
|
|
export default class RelativeTimestamp extends React.Component {
|
|
render() {
|
|
|
|
let now = moment.utc()
|
|
let rel = moment(now._d.getTime() - (this.props.value / 1000.0 / 1000.0))
|
|
|
|
return (
|
|
<span>{rel.fromNow(this.props.suffix)}</span>
|
|
);
|
|
}
|
|
}
|
|
|
|
|