import { Component } from 'inferno'; import * as moment from 'moment'; interface MomentTimeProps { data: { published: string; updated?: string; } } export class MomentTime extends Component { constructor(props: any, context: any) { 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()} ) } } }