interface TimeType {
	nowTime ?: string;
	nowDate ?: string;
	nowWeek ?: string;
}

const timeParams : TimeType = {
	nowTime: '',
	nowDate: '',
	nowWeek: ''
}

export const getTime = () => {
	const yy = new Date().getFullYear();
	const mm = new Date().getMonth() + 1;
	const dd = new Date().getDate();
	const week = new Date().getDay();
	const hh = new Date().getHours();
	const mf =
		new Date().getMinutes() < 10 ?
			"0" + new Date().getMinutes() :
			new Date().getMinutes();
	let ss = new Date().getSeconds().toString();
	ss = ss.length < 2 ? ('0' + ss) : ss;
	switch (week) {
		case 1:
			timeParams.nowWeek = "星期一";
			break;
		case 2:
			timeParams.nowWeek = "星期二";
			break;
		case 3:
			timeParams.nowWeek = "星期三";
			break;
		case 4:
			timeParams.nowWeek = "星期四";
			break;
		case 5:
			timeParams.nowWeek = "星期五";
			break;
		case 6:
			timeParams.nowWeek = "星期六";
			break;
		case 7:
			timeParams.nowWeek = "星期日";
	}
	timeParams.nowTime = hh + ":" + mf + ":" + ss;
	timeParams.nowDate = yy + "/" + mm + "/" + dd;
	
	return timeParams;
}
