1 import { Component } from 'inferno';
2 import moment from 'moment';
3 import { getMomentLanguage, setupTippy } from '../utils';
4 import { i18n } from '../i18next';
6 interface MomentTimeProps {
14 export class MomentTime extends Component<MomentTimeProps, any> {
15 constructor(props: any, context: any) {
16 super(props, context);
18 let lang = getMomentLanguage();
28 if (this.props.data.updated) {
31 data-tippy-content={this.format(this.props.data.updated)}
32 className="font-italics pointer unselectable"
34 {i18n.t('modified')} {moment.utc(this.props.data.updated).fromNow()}
38 let str = this.props.data.published || this.props.data.when_;
41 className="pointer unselectable"
42 data-tippy-content={this.format(str)}
44 {moment.utc(str).fromNow()}
50 format(input: string): string {