Check out example codes for "subtracting two date objects in javacript". It will help you in understanding the concepts better.

Code Example 1

function findDayDifference(date1, date2) {
	// always round down
  return Math.floor((Math.abs(date2-date1))/(1000*60*60*24));
}

Code Example 2

function dateDiffInDays(date1, date2) {
    // round to the nearest whole number
    return Math.round((date2-date1)/(1000*60*60*24));
}
var daysDiff=dateDiffInDays(new Date('December 21, 2019 03:24:00'), new Date('December 25, 2019 03:24:00')); //4 days till XMAS

Code Example 3

Example
<html>
   <head>
      <title>JavaScript setDate Method</title>
   </head>
   <body>
      <script>
         var dt = new Date("December 30, 2017 11:20:25");
         dt.setDate( dt.getDate() - 10 );
         document.write( dt );
      </script>
   </body>
</html>
Output
Wed Dec 20 2017 11:20:25 GMT+0530 (India Standard Time)

Learn ReactJs, React Native from akashmittal.com