moment js diff month comparisons

if 31st of may is today, then you add 1 month, then get the diff in months, it is NOT 1;

HTML

<script src="http://momentjs.com/downloads/moment.min.js"></script>

JavaScript

//... if you do not want fraction values 
var years = moment().diff('1981-01-01', 'years',false);
alert( years);

//... if you want fraction values 
var years = moment().diff('1981-01-01', 'years',true);
alert( years);


//... units can be [seconds, minutes, hours, days, weeks, months, years]