import dayjs from 'dayjs';
import { getCurrentLocale } from "../../../../../../utils/locale";

/**
 * @Title: 格式化日期
 * @Describe:
 * @Author: Wzw
 * @param {string} date
 * @param {string} format
 */
export var formatDate = function formatDate(date, format) {
  if (!date) {
    return date;
  }
  var lang = getCurrentLocale();
  var _format = format || ['HH:mm:ss DD/MM/YYYY', 'YYYY-MM-DD HH:mm:ss'];
  var type = lang === 'en-US' || lang === 'en' ? _format[0] : _format[1];
  return dayjs(date).format(type);
};