/**
|
* @description 获取年月日 时分秒
|
* @returns {string} yyyy-MM-dd hh:mm:ss
|
*/
|
export function getDate(option) {
|
if(option==null) return '';//如果为null,则返回空 【EditBy shaocx,2022-09-16】
|
const date = new Date(option);
|
let str = date.getFullYear() + '-' + addZero(date.getMonth() + 1) + '-' + addZero(date.getDate());
|
|
// if (option && option.full) {
|
str += ' ' + addZero(date.getHours()) + ':' + addZero(date.getMinutes()) + ':' + addZero(date.getSeconds());
|
// }
|
return str;
|
}
|
const addZero = function (date) {
|
return date > 9 ? date : '0' + date;
|
};
|