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 { getLanguage } from '../utils';
7 import { i18n } from '../i18next';
9 interface MomentTimeProps {
17 export class MomentTime extends Component<MomentTimeProps, any> {
19 constructor(props: any, context: any) {
20 super(props, context);
22 // Moment doesnt have zh, only zh-cn
23 let lang = getLanguage();
32 if (this.props.data.updated) {
34 <span title={this.props.data.updated} className="font-italics">{i18n.t('modified')} {moment.utc(this.props.data.updated).fromNow()}</span>
37 let str = this.props.data.published || this.props.data.when_;
39 <span title={str}>{moment.utc(str).fromNow()}</span>