export function timeFormat(time: Date, type: string) {
// yyyy MM dd hh:mm:ss
const year = `${time.getFullYear()}`;
const month = (time.getMonth() + 1 < 10 ? `0${time.getMonth() + 1}` : `${time.getMonth() + 1}`);
const day = (time.getDate() < 10 ? `0${time.getDate()}` : `${time.getDate()}`);
const hours = (time.getHours() < 10 ? `0${time.getHours()}` : `${time.getHours()}`);
const minutes = (time.getMinutes() < 10 ? `0${time.getMinutes()}` : `${time.getMinutes()}`);
const seconds = (time.getSeconds() < 10 ? `0${time.getSeconds()}` : `${time.getSeconds()}`);
let newTime = type.replace('yyyy', year).replace('MM', month).replace('dd', day);
newTime = newTime.replace('hh', hours).replace('mm', minutes).replace('ss', seconds);
return newTime;
}