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