1* * 根据险种的可选择年龄区间(年)获取出生年月日展示区间 规则--当前年-年龄/当前月/当前日+1 * */ 2 util.getAgeRangeWithYear = function (age) { 3 let nowDateYear = new Date().getFullYear() - 1; 4 let nowDateMonth = new Date().getMonth() + 1; 5 let nowDateDay = new Date().getDate(); 6 let birthdayYear = nowDateYear - age; let DateStr = birthdayYear + '/' + nowDateMonth + '/' + nowDateDay; // 处理月底最后一天日期加1时安卓和浏览器报错问题 7 let curdate = new Date(new Date(DateStr).getTime() + 1 * 24 * 60 * 60 * 1000); return new Date(curdate); 8 } 9 10 11 12 /* * 根据险种的可选择年龄区间(天)获取出生年月日展示区间 * */ 13 util.getAgeRangeWithDay = function (day) { 14 let currentDate = new Date().getTime(); 15 let minDate = currentDate - day * 24 * 60 * 60 * 1000; // 获取年,月,日 16 let birthdayYear = new Date(minDate).getFullYear(); let birthdayMonth = new Date(minDate).getMonth() + 1; 17 let birthdayDay = new Date(minDate).getDate(); 18 let birthday = birthdayYear + '/' + birthdayMonth + '/' + birthdayDay; 19 return new Date(birthday); 20 },
日期

LinMeng
2021-11-04
1074 2 0
点赞
收藏
评论区
加载中...