do nothing if already parsed

This commit is contained in:
Matthias Hannig 2018-10-01 15:14:53 +02:00
parent e52c84f68c
commit 655d316ac7

View File

@ -12,7 +12,15 @@ export default class RelativeTime extends React.Component {
return null;
}
let time = moment.utc(this.props.value);
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>
);