1 import { Component } from 'inferno';
2 import moment from 'moment';
3 import { getMomentLanguage, capitalizeFirstLetter } from '../utils';
4 import { i18n } from '../i18next';
6 interface MomentTimeProps {
15 export class MomentTime extends Component<MomentTimeProps, any> {
16 constructor(props: any, context: any) {
17 super(props, context);
19 let lang = getMomentLanguage();
25 if (this.props.data.updated) {
28 data-tippy-content={`${capitalizeFirstLetter(
30 )} ${this.format(this.props.data.updated)}`}
31 className="font-italics pointer unselectable"
33 <svg class="icon icon-inline mr-1">
34 <use xlinkHref="#icon-edit-2"></use>
36 {moment.utc(this.props.data.updated).fromNow(!this.props.showAgo)}
40 let str = this.props.data.published || this.props.data.when_;
43 className="pointer unselectable"
44 data-tippy-content={this.format(str)}
46 {moment.utc(str).fromNow(!this.props.showAgo)}
52 format(input: string): string {