https://dev.kronoz.win/r/marzneshin.git
1import { FC } from "react";
2import { TableRowWithCell } from "./table-row-with-cell";
3import { format, isValid } from "date-fns";
4
5export const DateTableRow: FC<{ label: string; date?: Date | null | string }> = ({
6 label,
7 date,
8}) => {
9 let formattedDate = "";
10 if (date && isValid(new Date(date))) {
11 formattedDate = format(date, "PPP");
12 }
13 return <TableRowWithCell label={label} value={formattedDate} />;
14};