
/**
 * Web唐明明
 * 匆匆数载恍如梦，岁月迢迢华发增。
 * 碌碌无为枉半生，一朝惊醒万事空。
 * moduleName: 日期
 */

export default getDate = (type) =>{
	return new Promise((resolve, reject) => {
		const date  = new Date()
		const year  = date.getFullYear()
		const month = (date.getMonth() + 1) <= 9 ? '0' + (date.getMonth() + 1)  : date.getMonth()
		const day	= date.getDate()
		
		switch(type){
			case 'day':
				resolve(year + '-' + month + '-' + day)
				break
			case 'month':
				resolve(year + '-' + month)
				break
			case 'year':
				resolve(year)
				break
			default:
				resolve(year + '-' + month + '-' + day)
		}
	})
}
