1 import { Component } from 'inferno';
2 import moment from 'moment';
3 import { getMomentLanguage, setupTippy, 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();
28 if (this.props.data.updated) {
31 data-tippy-content={`${capitalizeFirstLetter(
33 )} ${this.format(this.props.data.updated)}`}
34 className="font-italics pointer unselectable"
36 <svg class="icon icon-inline mr-1">
37 <use xlinkHref="#icon-edit-2"></use>
39 {moment.utc(this.props.data.updated).fromNow(true)}
43 let str = this.props.data.published || this.props.data.when_;
46 className="pointer unselectable"
47 data-tippy-content={this.format(str)}
49 {moment.utc(str).fromNow(true)}
55 format(input: string): string {