Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filter by date range

In Ember it is easy to filter an array where you are looking for matching values ( Only return name == "John) What I can't figure out is how to filter with a greater than or less than ( Return all objects whose startDate is before today

In my app I have a collection of deliverables. I want to divide these deliverables into three categories: Due within ten days, Past due, and then the rest.

I found the following example in another SO post, but can't figure out how to use it to accomplish my goal

filterComputed: function() {
  return this.get('content').filter(function(item, index, enumerable){
    return item.firstName == 'Luke';
  });
}.property('content.@each')
like image 552
Brian H Avatar asked May 01 '14 20:05

Brian H


People also ask

How do I filter rows by date?

Outlook Search by Date Locating messages for a single day is simple with the search bar. Click on the ​“Search”​ tab in Outlook and use the general search feature to filter by date. Type ​“received: Yesterday”​ or ​“received: Monday”​ to generate all messages received on those specific days.

How do I filter Google by date?

To get search results before a given date, add “before:YYYY-MM-DD” to your search query. For example, searching “the best donuts in Boston before:2008-01-01” will yield content from 2007 and earlier. To get results after a given date, add “after:YYYY-MM-DD” at the end of your search.

How do I change the date range filter?

To create a new date range filter open the filter pane at the top of the dashboard. Then, click the "+" button to the right of the dashboard-wide filter dropdown. Select "Create as date range filter" and then enter a title. *Note*: The custom filter cannot be named daterange, date_range, or aggregation.


1 Answers

You can just do:

this.get('content').filter(function(item){
    return item.get('someProperty') > someVar;
});
like image 90
NicholasJohn16 Avatar answered Oct 03 '22 00:10

NicholasJohn16