How do I calculate difference in months in Javascript?
Please note there are similar questions such as:
What's the best way to calculate date difference in Javascript
But these are based around MS difference, when some months have different number of days than others!
Any easy way to calculate month difference between 2 dates?
Just to be clear, I need to know how many months the dates span, for example:
Jan 29th 2010, and Feb 1st 2010 = 2 months
Jan 1st 2010, and Jan 2nd 2010 = 1 month
Feb 14th 2010, Feb 1st 2011 = 13 months
Feb 1st 2010, March 30th 2011 = 14 months
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…