moment js calculates months differently in different instances

I am using Moment JS to add dates. I want to add 2 months from today. I find these two lines of code to add two months give different results

// Today 29 03 2021
 moment().add(2, 'M').format('DD MM YYYY') // prints 29 03 2021
 moment().add(1, 'M').add(1, 'M').format('DD MM YYYY') //prints 28 03 2021

Can somebody explain why do we get different results and what is the right way to use moment js add function.

Thanks

80 thoughts on “moment js calculates months differently in different instances”

Leave a Comment