/*时间加一天*/constgetTimes=(time)=>{time=newDate(time.getTime()+3600*1000*24*1);constyear=time.getFullYear();constmonth=(time.getMonth()+1).toString().padStart(2,"0");constday=time.getDate().toString().padStart(2,"0");return`${年}-${月}-${日}`;}/*时间格式处理*/consttimeFormat=(date,status)=>{consty=date.getFullYear();//年份constm=(date.getMonth()+1).toString().padStart(2,'0');//月constd=date.getDate().toString().padStart(2,'0');//dayif(status)return`${y}-${m}-${d}00:00:00`;返回`${y}-${m}-${d}23:59:59`;}/*--------------------------------------------------*//*本周星期一*/constgetFirstDayOfWeek=(date,status=true)=>{constweekday=date.getDay()||7;date.setDate(date.getDate()-工作日+1);如果(状态)返回时间格式(日期,状态);returngetWeekLast(date);}/*本周最后一天*/constgetWeekLast=(data)=>{constnowTime=data.getTime();constday=data.getDay();constoneDayTime=24*60*60*1000;constSundayTime=nowTime+(7-day)*oneDayTime;returntimeFormat(newDate(SundayTime));}/*--------------------------------------------------------*//*本月第一天*/constgetFirstDayOfMonth=(date,status=true)=>{date.setDate(1);如果(状态)返回时间格式(日期,状态,'月');returnCurrentMonthLast(date);}/*本月最后一天*/constCurrentMonthLast=(date)=>{letcurrentMonth=date.getMonth();让nextMonth=++currentMonth;让nextMonthFirstDay=newDate(date.getFullYear(),nextMonth,1);让一天=1000*60*60*24;returntimeFormat(newDate(nextMonthFirstDay-oneDay));}/*----------------------------------------------------*//*今年年初*/constgetFirstDayOfYear=(date,status=true)=>{date.setDate(1);日期.setMonth(0);if(status)returntimeFormat(date,status,'年');returngetEndYear(date);}/*本年年尾*/constgetEndYear=(date)=>{date.setFullYear(date.getFullYear()+1);日期.setMonth(0);日期.setDate(0);返回时间格式(日期);}
