import { getLocale } from "./locales.js";
import dayjs from "dayjs";
//#region src/utils/date.ts
/**
* @title: 格式化时间
* @description:
* @param {Moment} date 时间
* @param {string} cnFormat 中文
* @param {string} enFormat 英文
* @return {*}
* @Author: Wzw
* @Date: 2022-07-28 11:57
*/
const formatDate = (date, cnFormat, enFormat) => {
	let _cnFormat = cnFormat || "LL";
	let _enFormat = enFormat || _cnFormat;
	let format = _cnFormat;
	let dayjs_local = "zh-cn";
	const umi_locale = getLocale();
	if (umi_locale !== "zh-CN" && umi_locale !== "zh-HK") {
		dayjs_local = "en-au";
		format = _enFormat;
	}
	if (umi_locale === "zh-TW") {
		dayjs_local = "zh-tw";
		format = _cnFormat;
	}
	dayjs.locale(dayjs_local);
	return dayjs(date).format(format);
};
//#endregion
export { formatDate };
