You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.tsx 471 B

1234567891011121314151617181920
  1. /*
  2. * @Author: 赵伟
  3. * @Date: 2024-04-28 14:18:11
  4. * @Description: 自定义 Table 日期类单元格
  5. */
  6. import { formatDate } from '@/utils/date';
  7. import dayjs from 'dayjs';
  8. function DateTableCell(text?: string | null) {
  9. if (text === undefined || text === null || text === '') {
  10. return <span>--</span>;
  11. }
  12. if (!dayjs(text).isValid()) {
  13. return <span>无效的日期</span>;
  14. }
  15. return <span>{formatDate(text)}</span>;
  16. }
  17. export default DateTableCell;