Reputation: 792
I want to add 7 days in the date using momentJs in angular project.
let nextRunAt = "2018-08-16T02:00:00.242Z";
let calculatedRunAt = moment(nextRunAt).add(7, 'days');
I am expecting to get the date after 7 days but instead I get moment object.
Any help is appreciated. Thanks
Upvotes: 2
Views: 2001
Reputation: 553
The moment method returns a moment object, you have to convert it to date-
let calculatedRunAt = moment(nextRunAt, "DD-MM-YYYY").add(7, 'days').toDate();
Upvotes: 4