What can I do to compare these different Date-Types for my filter????
MongDB:
2015-04-29T22:00:00.000Z
Datepicker:
Wed Apr 08 2015 00:00:00 GMT+0200 (CEST)
I have a MEAN Stack and write Data from a form into a MongoDB Database. My database entry looks like this:
dt for Date

I use UI-Bootstrap Datepicker to pick the date and save it in this format:
2015-03-31T22:00:00.000Z
Now I have two other Datepickers to set a range and filter them. But when I choose a date in the Datepickers the format change to:
Wed Apr 08 2015 00:00:00 GMT+0200 (CEST)
and I can't compare these two data in my Filter:
angular.module('reklaApp')
.filter('dateFilter', function () {
return function (items, fromDate, toDate) {
var filtered = [];
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (item.dt > fromDate && item.dt < toDate){
filtered.push(item);
}
}
return filtered;
};
});