Categories
JavaScript Answers

How to properly add 1 month from now to current date in moment.js and JavaScript?

Spread the love

To properly add 1 month from now to current date in moment.js and JavaScript, we call the add method.

For instance, we write

const d = moment().add(1, "months").calendar();

to call moment to create a moment object with the current date and time.

Then we call add to add 1 month to the date.

And we call calendar to return the date string with the date.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *