Angular ng-repeat filter / search by formatted date
I have a list of date objects that I want to display like this:
<div ng-repeat="myDate in myDates | filter:dateFilter">{{myDate | date:'dd. MMMM yyyy'}}</div>
DateFilter is bound to an input field.
Now the problem is that when I type "October" for example no date was found because angular only seems to be looking for a date object that looks like this:
Thu Oct 27 2009 00:00:00 GMT+0200 (Mitteleuropรคische Sommerzeit)
Can I also search in the formatted date string "October 27, 2009"?
+3
source to share
1 answer
You have to implement your own filtering function, which is pretty easy to do: https://docs.angularjs.org/tutorial/step_09
This way you can implement any custom filtering logic you would like to have.
0
source to share