2

i am trying to filter rows based on date as an criteria. Using the input type date as one of the search criteria, and filtering the rows based on the attribute name is not working.

ex - <input type="date" ng-model="searchc_date" name="dtCsltDoctor"> <li ng-repeat="cs in consultations|filter:searchc_date"> Is not yielding any result. I changed the data to be of same format. No matching rows.

Fiddle for the code

1 Answer 1

3

The issue is still with your date formats. Because dates in JS are just a royal pain, whenever I do comparisons I usually use a library like moment.js to format the dates so I can make them match.

<pre>fake code to get past SO's requirement</pre>

This works: http://jsfiddle.net/6432E/8/

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Sharondio, You are right. Moment does sync up the date for me. But I used to store data in "date format" in Mongo. I will convert them to string and manipulate it in models. Thanks, this works. Appreciate it.
just remember when you're putting them back into Mongo to save them back in as new Date().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.