how to convert days to month in js?
<p>This is my code:</p>

<pre><code>var date1 = '01/02/2017';
var date2 = '31/01/2020';

var startDate   = new Date( date1.split("/")[2], date1.split("/")[1]-1, date1.split("/")[0] );
var endDate     = new Date( date2.split("/")[2], date2.split("/")[1]-1, date2.split("/")[0] );

var diff = new Date(endDate - startDate);
var diffResult = ((diff.getFullYear() - 1970) * 12+ diff.getMonth()) + " months";
</code></pre>

<p>so the output is only 35 months (and also 30 days but its hidden)
but as 30 days are actually already a month, I would like to have it as 36 months.
any suggestions?</p>

<p>thanks </p>