Babban matsalar da ke da alaฦa da bambanci tsakanin kwanakin biyu ita ce ฦila ba za su kasance a yankin lokaci ษaya ba.
var date1 = new Date(2018, 11, 24); var date2 = new Date(2018, 11, 30); var diffDays = date2.getDate() - date1.getDate();
Wannan lambar tana ฦirฦirar sabbin abubuwa guda biyu na Kwanan wata, ษaya don Disamba 24th, 2018 da ษaya don Disamba 30th, 2018. Daga nan ne gano bambanci tsakanin waษannan kwanakin biyu ta hanyar .getDate().
Math tare da kwanakin
var kwanan wata = sabon Kwanan wata (); // 1/1/0001 var date2 = sabon Kwanan wata (); // 12/31/9999