Can you put this in a codepen with some sample data from your http request so we can see what the data looks like? Or at least tell us what format the date is being returned in from the http call.
Sorry for the late response, I’ve been a little busy at work.
I made a codepen with your example with a working way to filter the date. There’s a few things going on here - I split the startdate string up into pieces to create the date object because it was creating the date with the wrong day in that format.
Then, I filter both of them using the angular date filter so they are in the same format. You can erase the input field at the top to remove the filter and type in it to add the filter back. Hope this helps!
Edit: Added a formatted date to the second item so you could see the filter working better.
Sorry for the late response, had some other tasks with high priority. I have another question:
I would like to show “No events for this day” if there aren’t any events which corresponds to the selectedDate.
For other pages in my app I use:
<ion-item class="animate-repeat" ng-if="events.length == 0">
No requests for today
</ion-item>
But now, the ‘events’ variable isn’t empty… But when filtering with ‘start:selectedDate’ it is, how to check on this?
I use this piece of code also in a different case. The variable $scope.checkCal contains the startdate of the selected request. (in the request details page):
This code is used to display the requests with the same startdate as the request that is selected. This all works well, but because the selected request also has this date, the selected request is also displayed.
So, I would like to display ALL OTHER requests with the same date.
The code I use:
<div class="item item-divider">
Other events during this period
</div>
<ion-item class="item item-avatar blueborder" ng-repeat="e in filtered = (events | filter:{start:checkCal})">
<img class="usereventsimg" ng-src="{{e.picture}}">
<h3 class="marginleft">{{e.firstname}} {{e.lastname}}</h3>
<p class="marginleft">{{e.status}}</p>
</ion-item>
<ion-item class="blueborder" ng-if="filtered.length == 0">
No requests found
</ion-item>
You can add an ng-if to the ion-item so that it won’t show the item if it is the selected request. I’m not sure of the event object but use the unique identifier: