let startdate = "2019-04-01T04:00:00.000Z"; let endate = "2019-04-08T04:00:00.000Z"; let days = (new Date(endate) - new Date(startdate)) / 1000 / 60 / 60 / 24; console.log(days); // 输出结果 7