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