js按照相同日期再组装数组

来源:互联网 发布:淘宝有卖寿衣 编辑:程序博客网 时间:2024/05/22 15:46
//按时间再分function TimeList(res){    var arr=[],        arr1=[];    var isTrue = true;    for(var i=0;i<=res.list.length;i++){        if(isTrue){            arr1.push(res.list[i]);        }else{            arr.push(arr1);            arr1 = [];            arr1.push(res.list[i]);        }        if(i+1<res.list.length){            if(bainx.formatDate('Y-m-d', new Date(res.list[i].lastUpdated))==bainx.formatDate('Y-m-d', new Date(res.list[i+1].lastUpdated))){                isTrue = true;            }else{                isTrue = false;            }        }else{            isTrue = false;        }    }    return arr;}

0 0
原创粉丝点击