]> Untitled Git - lemmy.git/blob - ui/src/components/moment-time.tsx
Merge branch 'dev' into moderation
[lemmy.git] / ui / src / components / moment-time.tsx
1 import { Component } from 'inferno';
2 import * as moment from 'moment';
3
4 interface MomentTimeProps {
5   data: {
6     published: string;
7     updated?: string;
8   }
9 }
10
11 export class MomentTime extends Component<MomentTimeProps, any> {
12
13   constructor(props: any, context: any) {
14     super(props, context);
15   }
16
17   render() {
18     if (this.props.data.updated) {
19       return (
20         <span title={this.props.data.updated} className="font-italics">modified {moment.utc(this.props.data.updated).fromNow()}</span>
21       )
22     } else {
23       return (
24         <span title={this.props.data.published}>{moment.utc(this.props.data.published).fromNow()}</span>
25       )
26     }
27   }
28 }