import { DEFAULT_LABEL } from '@/constants/enumerate';
import { formatDate } from './utils';

export function timestampFilter(val: number | null): string {
  return val ? formatDate('YYYY-MM-DD HH:mm:ss', new Date(val)) : DEFAULT_LABEL;
}

interface CourseNameCode {
  courseName: string;
  courseCode: string;
}
export function courseNameCodeFilter(val: CourseNameCode) {
  return `${val.courseName || DEFAULT_LABEL}（${
    val.courseCode || DEFAULT_LABEL
  }）`;
}
