js 兼容iOS的时间 计算时间差(天数)

getdate(startTime, endTime){
      var start = startTime.split(/[- : \/]/);
      var date1 = new Date(start [0], start [1]-1, start [2], start [3], start [4], start [5]);
      var end=endTime.split(/[- : \/]/);
      var date2 = new Date(end[0], end[1]-1, end[2], end[3], end[4], end[5]);
      var c1 = date2.getTime()-date1.getTime();//毫秒差
      var c2 = (date2.getTime()-date1.getTime())/1000;//秒差 
      console.log(this.formatSeconds(c2))
    },
    formatSeconds(value) { 
      var theTime = parseInt(value);// 需要转换的时间秒 
      var theTime1 = 0;// 分 
      var theTime2 = 0;// 小时 
      var theTime3 = 0;// 天
      if(theTime > 60) { 
        theTime1 = parseInt(theTime/60); 
        theTime = parseInt(theTime%60); 
        if(theTime1 > 60) { 
          theTime2 = parseInt(theTime1/60); 
          theTime1 = parseInt(theTime1%60); 
          if(theTime2 > 24){
            //大于24小时
            theTime3 = parseInt(theTime2/24);
            theTime2 = parseInt(theTime2%24);
          }
        } 
      } 
      var result = '';
      if(theTime3 > 0) { 
        result = ""+parseInt(theTime3); 
      }
      return result; 
    },

// 备注 ios苹果手机 中 new Date()转换时间兼容问题的处理方式

var start = '2023-07-03 10:10:10'
// 转换格式为 2023/07/03 10:10:10
var start = new Date(start.replace(/-/g, '/'))
// 输出时间戳
var seconds=Date.parse(start)