按日期范围过滤

Bri*_*n H 6 date filter ember.js

在Ember中,很容易过滤一个数组,你正在寻找匹配的值(只返回名称=="约翰")我不知道如何过滤大于或小于(返回其startDate为的所有对象)在今天之前

在我的应用程序中,我有一系列可交付成果.我想将这些可交付成果分为三类:十天内到期,过期,然后是其他.

我在另一篇SO帖子中找到了以下示例,但无法弄清楚如何使用它来实现我的目标

filterComputed: function() {
  return this.get('content').filter(function(item, index, enumerable){
    return item.firstName == 'Luke';
  });
}.property('content.@each')
Run Code Online (Sandbox Code Playgroud)

Nic*_*n16 4

你可以这样做:

this.get('content').filter(function(item){
    return item.get('someProperty') > someVar;
});
Run Code Online (Sandbox Code Playgroud)