首页布局,使用若依时间格式化
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user