import { Component, linkEvent } from 'inferno'; import * as moment from 'moment'; interface MomentTimeProps { data: { published: string; updated?: string; } } export class MomentTime extends Component { constructor(props, context) { super(props, context); } render() { if (this.props.data.updated) { return ( modified {moment.utc(this.props.data.updated).fromNow()} ) } else { return ( {moment.utc(this.props.data.published).fromNow()} ) } } }