数组对象里面对日期进行排序

var  hislist =  [{ 'id':'1','date','2020-11-21  15:16:09'},
                     { 'id':'2','date','2020-11-22  10:11:06'},
                     { 'id':'3','date','2020-11-24  15:32:06'},
                      { 'id':'4','date','2020-11-25  18:41:46'}];
   let Onecycledate: any = hislist;
    let twocycledate = Onecycledate.hisList;

    let way: any = Array.from(new Set(twocycledate));
    let rows = way.rows;
    way = rows.sort(function (a, b) {
      return Date.parse(a.createDate) - Date.parse(b.createDate)
    });
    let createDate = way[0].createDate;

  



        

  

posted @ 2020-11-24 20:59  小小小菜鸟1  阅读(575)  评论(0编辑  收藏  举报