首页布局,使用若依时间格式化

This commit is contained in:
熊丽君
2021-08-04 11:16:36 +08:00
parent 591d2bef16
commit 99d35969a0
27 changed files with 302 additions and 75 deletions

View File

@ -46,26 +46,3 @@ export function str2Date(dateStr, separator) {
let date = new Date(year, month - 1, day);
return date;
}
export function formatTime(value, type) {
let date = new Date(value);
let year = date.getFullYear();
let month = date.getMonth() + 1;
month = month > 9 ? month : '0' + month;
let day = date.getDate();
day = day > 9 ? day : '0' + day;
let hh = date.getHours();
hh = hh > 9 ? hh : '0' + hh;
let mm = date.getMinutes();
mm = mm > 9 ? mm : '0' + mm;
let ss = date.getSeconds();
ss = ss > 9 ? ss : '0' + ss;
let time = '';
if (type === 1) {
//不带时分秒
time = year + '-' + month + '-' + day;
} else {
time = year + '-' + month + '-' + day + ' ' + hh + ':' + mm + ':' + ss;
}
return time;
}