'use strict'; // 获取字典是否 exports.getIsNot = function(value) { let isNot = ''; // eslint-disable-next-line default-case switch (value) { case '0': isNot = '否'; break; case '1': isNot = '是'; break; case '2': isNot = '无资格'; break; } return isNot; }; // 获取两个时间差 exports.begindateEnddateSum = function(begindate, enddate) { const sumDate = []; const startTime = getDate(begindate); const endTime = getDate(enddate); while (endTime.getTime() - startTime.getTime() >= 0) { const year = startTime.getFullYear(); const month = startTime.getMonth().toString().length === 1 ? '0' + startTime.getMonth().toString() : startTime.getMonth(); const day = startTime.getDate().toString().length === 1 ? '0' + startTime.getDate() : startTime.getDate(); sumDate.push(year + '-' + month + '-' + day); startTime.setDate(startTime.getDate() + 1); } // console.log(sumDate); return sumDate; }; function getDate(datestr) { const temp = datestr.split('-'); // new Date()的月份入参实际都是当前值-1 const date = new Date(temp[0], temp[1], temp[2]); return date; // const temp = datestr.split('-'); // const date = new Date(temp[0], temp[1], temp[2]); // return date; }