1

I have a date as string

var myOldDate = "2019-10-25";

I want add 90 days to my string date, apparently it's complicated, is there any easy way to increment date in JQuery?

mojtaba sh
  • 93
  • 7
  • 4
    Does this answer your question? [Add days to JavaScript Date](https://stackoverflow.com/questions/563406/add-days-to-javascript-date) Also, jQuery is not a date manipulation library. Consider using [MomentJS](https://momentjs.com/) or [datefns](https://date-fns.org/). – Alexander van Oostenrijk Dec 31 '19 at 08:54

1 Answers1

1

You can try this:

var myOldDate = "2019-10-25";
var date = new Date(myOldDate);
date.setDate(date.getDate() + 90);
console.log(date.toISOString().split('T')[0])
Ankita Kuchhadiya
  • 1,255
  • 6
  • 16