1 import { Component } from 'inferno';
2 import * as moment from 'moment';
3 import 'moment/locale/es';
4 import 'moment/locale/de';
5 import 'moment/locale/zh-cn';
6 import 'moment/locale/fr';
7 import 'moment/locale/sv';
8 import 'moment/locale/ru';
9 import { getMomentLanguage } from '../utils';
10 import { i18n } from '../i18next';
12 interface MomentTimeProps {
20 export class MomentTime extends Component<MomentTimeProps, any> {
22 constructor(props: any, context: any) {
23 super(props, context);
25 let lang = getMomentLanguage();
31 if (this.props.data.updated) {
33 <span title={this.props.data.updated} className="font-italics">{i18n.t('modified')} {moment.utc(this.props.data.updated).fromNow()}</span>
36 let str = this.props.data.published || this.props.data.when_;
38 <span title={str}>{moment.utc(str).fromNow()}</span>