0

Below is the code to get the date range between start and end date but when the array is returned getDate is not a function error is consoled

  checkdate(dt){
    let dtdates=new Date(dt);
    dtdates.setDate(dt.getDate() + 1);
    return dtdates
  }
  getDates(pstart1,pend2){
    
    console.log(pstart1);
    console.log(pend2);
    
    let dt:Date= pstart1
    console.log(dt);
    
    while(dt<=pend2){
      this.dates.push(dt);
      dt=this.checkdate(dt) 
      console.log(this.dates)
    }
   
    return this.dates;
  }

Am I missing something here?

y_159
  • 458
  • 3
  • 15
am's
  • 21
  • 7
  • ngbdatepicker, by defect mannage object of type `{year:..month:..,day:..}`, **not** object date – Eliseo Aug 12 '21 at 06:16

1 Answers1

0
dtdates.setDate(dtdates.getDate() + 1);

This is probably what you want to do.

Miigon
  • 779
  • 6
  • 18
  • that error is fixed but now i am not getting the ranges is there any problem with my code @miigon – am's Aug 12 '21 at 06:07