1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00
Matthias Hannig 4086594676 fixed minor issues
2018-10-01 19:11:06 +02:00

30 lines
432 B
JavaScript

import moment from 'moment'
import React from 'react'
export default class RelativeTime extends React.Component {
render() {
if (!this.props.value) {
return null;
}
let time = false;
if (this.props.value instanceof moment) {
time = this.props.value;
} else {
time = moment.utc(this.props.value);
}
return (
<span>{time.fromNow(this.props.suffix)}</span>
);
}
}