formatter.ts 438 B

1234567891011121314151617
  1. import type { VxeUIExport } from 'vxe-table';
  2. import dayjs from 'dayjs';
  3. export function initDefaultFormatter(vxeUI: VxeUIExport) {
  4. vxeUI.formats.add('formatDate', {
  5. tableCellFormatMethod({ cellValue }) {
  6. return dayjs(cellValue).format('YYYY-MM-DD');
  7. },
  8. });
  9. vxeUI.formats.add('formatDateTime', {
  10. tableCellFormatMethod({ cellValue }) {
  11. return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss');
  12. },
  13. });
  14. }