Files
bodyshop/client/src/utils/DateFormatter.jsx
Allan Carr 7e99a51495 IO-2214 Lost Sale Date
Add date_lost_sale to track date sale was lost, add in Audit Trail for both cancel and insertion of schedule, standardize date format on output.
2023-11-22 17:32:35 -08:00

38 lines
930 B
JavaScript

import { Tooltip } from "antd";
import moment from "moment";
import React from "react";
export function DateFormatter(props) {
return props.children
? moment(props.children).format(
props.includeDay ? "ddd MM/DD/YYYY" : "MM/DD/YYYY"
)
: null;
}
export function DateTimeFormatter(props) {
return props.children
? moment(props.children).format(
props.format ? props.format : "MM/DD/YYYY hh:mm a"
)
: null;
}
export function TimeFormatter(props) {
return props.children
? moment(props.children).format(props.format ? props.format : "hh:mm a")
: 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;
}
export function DateTimeFormat(value) {
return moment(value).format("MM/DD/YYYY hh:mm A");
}