Adding Days to the Date Object Using Moment.js

I’m working on a real estate project for a while. I needed to add days to JavaScript Date object for a set new date to a Datepicker component. Probably you will not need to use JavaScript Date object.

Adding Days to the Date Object Using Moment.js

Buefy’s Datepicker component requires JavaScript date object unless you use your own date parser. Anyway, I had a Datepicker component like that;

In order to add days to JavaScript’ Date object, you can use Moment.js like that;

You should be careful, Date() and new Date() are different things when you use Date object. If you use Date() directly, this will be a string. If you use with new keyword this will be an object. So, in this case, I’ll use like that;

I hope this will help you.