export const dateFormat = (value, fmt, type) => {
if (type) return ifDate(value, fmt);
else return timeTo(value, fmt);
//判断当前返回的是星期几
function week(dayNum) {
if (dayNum == 7 ) return “日”;
if (dayNum == 1) return “一”;
if (dayNum == 2) return “二”;
if (dayNum == 3) return “三”;
if (dayNum == 4) return “四”;
if (dayNum == 5) return “五”;
if (dayNum == 6) return “六”;
}
funtion timeTo(value, fmt) {
if(!value || value == ‘’) return value;
if (typeof value == ‘string’ && value.indexOf(",") > -1)
value = value.split(",")[0]; //时间格式带小数点则需把小数点去掉
let getDate = new Date(value);
let o = {
“M+”: getDate.getMonth() + 1,
“d+”: getDate.getDate(),
“h+”: getDate.getHours(),
“m+”: getDate.getMinutes()
};
}