Get the start date and end date through the month

/Time is 202108 format
 
getNearMonth(time){
    if(time != null && time != ” ” ){
Var nyyear = time.slice (0, 4);
Var nymonth = time.slice (4, time.length);
Var firstday = new date (nyyear, nymonth-1);
Var lastday = new date (new date (nyyear, nymonth) .valueof () – 60 * 60 * 1000 * 24);
Function DataSformat (D) {
Var DateTime = D.Getfullyear () + (D. GetMonth () + 1) + ‘-‘ + D.Getdate ();
Return DateTime;
          console.log(datetime,777)
      }
Var firstday = DataSformat (firstday)
Var lastday = DataSformat (LastDay)
console.log (Firstday, Lastday, 111)
    }
  },