參考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");
}
}
},