// 时间戳render为日期
import { GridSettings } from '@sc/handsontable';
import dayjs from 'dayjs';
import { text } from '@/utils/frontend/dom';

export default function timestampRender(
  instance: Handsontable,
  row: number,
  col: number,
  prop: string | number,
  value: number,
  cellProperties: GridSettings
): HTMLElement {
  const span = document.createElement('span');
  const dateStr = value ? dayjs(value).format('YYYY-MM-DD') : '';
  text(span, dateStr);
  return span;
}
