SOURCE

moment().locale('zh-cn');
const log = console.log;
const table = console.table;

var list = [{
  "id": 255,
  "createdAt": "2017-10-11T19:15:14+0800",
  "actionType": "P_DEPLOY_BRANCH",
  "action": "部署项目分支",
  "memo": "项目名: blog-demo, 分支: master",
  "avatar": "//terminus-self.oss-cn-hangzhou.aliyuncs.com/uc/2017/01/22/59e2d2ef-66a6-48ec4.jpeg",
  "detailLogId": "152"
},
{
  "id": 254,
  "createdAt": "2017-10-11T19:14:51+0800",
  "actionType": "P_PACK_BRANCH",
  "action": "打包项目分支",
  "memo": "项目名: blog-demo, 分支: master",
  "avatar": "//terminus-self.oss-cn-hangzhou.aliyuncs.com/uc/2017/01/22/59e2d2ef-66a6-48ec4.jpeg",
  "detailLogId": "62"
},
{
  "id": 253,
  "createdAt": "2017-10-11T17:35:30+0800",
  "actionType": "P_DEPLOY_BRANCH",
  "action": "部署项目分支",
  "memo": "项目名: blog-demo, 分支: master",
  "avatar": "//terminus-self.oss-cn-hangzhou.aliyuncs.com/uc/2017/01/22/59e2d2ef-66a6-48ec4.jpeg",
  "detailLogId": "151"
},
{
  "id": 252,
  "createdAt": "2017-10-11T17:34:48+0800",
  "actionType": "P_PACK_BRANCH",
  "action": "打包项目分支",
  "memo": "项目名: blog-demo, 分支: master",
  "avatar": "//terminus-self.oss-cn-hangzhou.aliyuncs.com/uc/2017/01/22/59e2d2ef-66a6-48ec4.jpeg",
  "detailLogId": "61"
},
{
  "id": 251,
  "createdAt": "2017-10-09T17:34:48+0800",
  "actionType": "P_CREATE_BRANCH",
  "action": "创建项目分支",
  "memo": "项目名: blog-demo, 分支: master",
  "avatar": "//terminus-self.oss-cn-hangzhou.aliyuncs.com/uc/2017/01/22/59e2d2ef-66a6-48ec4.jpeg",
  "detailLogId": ""
}];

var test = '2017-10-11T19:15:14+0800';
var now = moment();
var yesterdayStart = moment().subtract(1, 'd').startOf('day');
var yesterdayEnd = moment().subtract(1, 'd').endOf('day');
var lldaysEnd = moment().subtract(4, 'd').startOf('day');
log(lldaysEnd.date());

var yesterday = [];
var in3Days = [];
list.map(item => {
  let createdAt = moment(item.createdAt);
  if (createdAt.isBetween(yesterdayStart, yesterdayEnd)) {
    yesterday.push(item.createdAt);
  } else if (createdAt.isBetween(yesterdayEnd, lldaysEnd)) {
    in3Days.push(item.createdAt);
  }
})

table(yesterday);
table(in3Days);
console 命令行工具 X clear

                    
>
console