I am using `DatePicker` control in SAPUI5, I want to calculate total days between `selected` start date and end date.

```js
var startDate = this.getView().byId("DP-FromDate").getValue();
var endDate = this.getView().byId("DP-ToDate").getValue();
var sDate = new Date(startDate);
var eDate = new Date(endDate);

var diff = Math.abs(sDate.getTime() - eDate.getTime());
var diffD = Math.ceil(diff / (1000 * 60 * 60 * 24)); 
alert(diffD);

```

I am getting `sdate & eDate` are `Invalid dates` Error.