Add months to Date


I am trying to add months to my date.

My current code is

var x = moment(,"MMM d, yyyy").add(3,'months');
return x;

However the result is wrong and completely random
With input 3rd Jan 2022, It is returning 8th of June 2022.

Please help me with this

Hi @Kowshik_Bokka,

you are returning a moment object here. Try adding a .format('LLLL') to your moment line.

Hi @jocen
It is still not working.
My requirement is simply to add 'x' months to a date input and return the value.

What is the best way to do that?

Also, I am trying to understand why

var x = moment(
return x

is returning 28th Feb 2022 when the input is 3rd Jan 2022.

@Kowshik_Bokka, what is the exact input from

hey I was able to reosolve. There was an issue with the format of the date. Thanks for the help.