/*
 * @Author: 赵伟
 * @Date: 2024-04-28 14:18:11
 * @Description: 自定义 Table 日期类单元格
 */

import { formatDate } from '@/utils/date';
import dayjs from 'dayjs';

function DateTableCell(text?: string | null) {
  if (text === undefined || text === null || text === '') {
    return <span>--</span>;
  }
  if (!dayjs(text).isValid()) {
    return <span>无效的日期</span>;
  }
  return <span>{formatDate(text)}</span>;
}

export default DateTableCell;
