1 import { Component } from 'inferno';
2 import moment from 'moment';
3 import { getMomentLanguage, capitalizeFirstLetter } 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();
24 if (this.props.data.updated) {
27 data-tippy-content={`${capitalizeFirstLetter(
29 )} ${this.format(this.props.data.updated)}`}
30 className="font-italics pointer unselectable"
32 <svg class="icon icon-inline mr-1">
33 <use xlinkHref="#icon-edit-2"></use>
35 {moment.utc(this.props.data.updated).fromNow(true)}
39 let str = this.props.data.published || this.props.data.when_;
42 className="pointer unselectable"
43 data-tippy-content={this.format(str)}
45 {moment.utc(str).fromNow(true)}
51 format(input: string): string {