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 { getLanguage } 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 // Moment doesnt have zh, only zh-cn
24 let lang = getLanguage();
33 if (this.props.data.updated) {
35 <span title={this.props.data.updated} className="font-italics">{i18n.t('modified')} {moment.utc(this.props.data.updated).fromNow()}</span>
38 let str = this.props.data.published || this.props.data.when_;
40 <span title={str}>{moment.utc(str).fromNow()}</span>