Added time ago formatter + schema changes for BOD-198

This commit is contained in:
Patrick Fic
2020-08-20 14:43:59 -07:00
parent af0b08e7f1
commit 97629a91fb
9 changed files with 95 additions and 6 deletions

View File

@@ -1,14 +1,24 @@
import React from "react";
import moment from "moment";
import Moment from "react-moment";
import { Tooltip } from "antd";
export function DateFormatter(props) {
return props.children ? (
<Moment format="MM/DD/YYYY ">{props.children}</Moment>
) : null;
}
export function DateTimeFormatter(props) {
return props.children ? (
<Moment format="MM/DD/YYYY @ HH:mm">{props.children}</Moment>
) : null;
}
export function TimeAgoFormatter(props) {
const m = moment(props.children);
return props.children ? (
<Tooltip placement="top" title={m.format("MM/DD/YYY hh:mm A")}>
{m.fromNow()}
</Tooltip>
) : null;
}