This is my code for getting days difference from given dates. I need the days accurately, Here my correct days different is '2' but i am getting 1. i am using moment.js for this operation in angular. This is not taking time . I need time to take for getting result. I am using this code in calendar so i need to take time too.
var startdate=new Date('2017-12-30 06:00:00');
var enddate=new Date('2018-01-01 01:00:00');
var diff= moment(enddate).diff(startdate, "days");
console.log(diff)