[Fixed] Angular 8 How to Add days to current date

Issue

I want to add days to the current date

I have tried currentdate.getDate() but this dosent work

console.log(formatDate(this.currentUser.businessDate, 'dd-EEE', 'en-Us'));
console.log(formatDate(this.currentUser.businessDate, 'dd-MMM', 'en-Us'));
let a=this.currentBusinesDate.getDate();

If date is 23-Jun and i add 1 date it shoud be 24-Jun

Solution

try this:

date: Date;

ngOnInit() {
  this.date = new Date();
  this.date.setDate( this.date.getDate() + 1 );
}

Leave a Reply

(*) Required, Your email will not be published