Closed
Description
I haven't explored to see all the circumstances that can cause it, but I notice that a duration's fields do not necessarily get normalized after subtraction. Depending on how you do the same subtraction (conceptually), you get different results.
Here's a fiddle to see the issue in action:
http://jsfiddle.net/9cs8o1v1/3/
A test that would break due to this bug is:
var subtract1 = moment.duration(600, "days").subtract(1, "year");
var subtract2 = moment.duration(600, "days").subtract(365, "days");
assertEqual(subtract1.months(), subtract2.months());
As you can see in the fiddle, subtract1.months() yields -5, while subtract2.months() yields 7.