参考ant design内Table表头日期字段排序

moment方法,仅用于处理日期格式

import moment from 'moment'

sorter为组件内字段


        {
          title: '截止日期',
          width: 150,
          align: "center",
          dataIndex: 'endTime',
          sorter: (a, b) => {
            return new Date(a.endTime) > new Date(b.endTime) ? 1 : -1;
          },
          customRender: function (text){
            if(text == '' || text == null){
              return '/';
            } else {
              return moment(text).format("YYYY-MM-DD");
            }
          }
        },

相关文章:

  • 2022-12-23
  • 2021-12-12
  • 2021-10-27
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-27
  • 2021-09-09
相关资源
相似解决方案