I have a javascript function which add a certain amount of hours to a provided date and return the new date as follows.
$scope.CalDate = function()
{
var preDate = "2019-06-20 21:30";
var formatDate = new Date(preDate );
var diffHours = 2.30;
var newDate = new Date(formatDate.getTime() + (diffHours*1000*60*60));
return newDate;
}
Actual answer should be Wed Jun 21 2019 00:00:00. But it returns the following answer. Thu Jun 20 2019 23:48:00. Why is it happening ?