-1

I get an object Date whith format ( YYYY-MM-DD) and I want to create an object and add one day to this object ( if my object is 2020-03-10, I would like to get 2020-03-11), how can I do ?

this.mypensionsort.dtFin //the object Date
const dateDayPlusOne = new Date(this.mypensionsort.dtFin.getDate() + 1); //Doesn't work
Pelodido
  • 15
  • 5
  • 1
    Does this answer your question? [Add days to JavaScript Date](https://stackoverflow.com/questions/563406/add-days-to-javascript-date) – jonrsharpe Mar 20 '20 at 09:58

1 Answers1

1

You can use javascript getDate and setDate function to achieve this. see the example

const mydate="2020-03-10";
const newDate = new Date(mydate);
const result = new Date(newDate.setDate(newDate.getDate() + 1));
console.log(result);
Deepu Reghunath
  • 8,132
  • 2
  • 38
  • 47