日期

LinMeng 等级 141 0 0
标签:
* * 根据险种的可选择年龄区间(年)获取出生年月日展示区间 规则--当前年-年龄/当前月/当前日+1 * */
 util.getAgeRangeWithYear = function (age) { 
   let nowDateYear = new Date().getFullYear() - 1; 
   let nowDateMonth = new Date().getMonth() + 1; 
   let nowDateDay = new Date().getDate(); 
   let birthdayYear = nowDateYear - age; let DateStr = birthdayYear + '/' + nowDateMonth + '/' + nowDateDay; // 处理月底最后一天日期加1时安卓和浏览器报错问题 
   let curdate = new Date(new Date(DateStr).getTime() + 1 * 24 * 60 * 60 * 1000); return new Date(curdate);
    }



    /* * 根据险种的可选择年龄区间(天)获取出生年月日展示区间 * */ 
    util.getAgeRangeWithDay = function (day) {
      let currentDate = new Date().getTime();
      let minDate = currentDate - day * 24 * 60 * 60 * 1000; // 获取年,月,日
      let birthdayYear = new Date(minDate).getFullYear(); let birthdayMonth = new Date(minDate).getMonth() + 1;
      let birthdayDay = new Date(minDate).getDate(); 
      let birthday = birthdayYear + '/' + birthdayMonth + '/' + birthdayDay; 
        return new Date(birthday);
      },
收藏
评论区

相关推荐