import moment from "moment"

export function dateNewFormat(
  value: string | Date | null | undefined,
  format: string = "YYYY-MM-DD",
  nullValue: string = ""
): string {
  if (!value || value === "0000-00-00 00:00:00") {
    return nullValue
  }

  return moment(value, 'YYYY-MM-DD HH:mm:ss').format(format)
}
