Open nandhuems opened 6 years ago
To sort by date you need to add parsing information in the template syntax that matches your date syntax. Table specifies "deliveryDate":
<table class="table table-condensed table-striped text-center" [(mfSortBy)]="deliveryDate" [(mfSortOrder)]="sortOrder" [mfData]="data" #mf="mfDataTable">
Header specifies with the "by" directive:
<thead><tr><th class="text-center"><mfDefaultSorter by="deliveryDate"><span>Order Date</span</mfDefaultSorter></th>
And in the tbody the crucial template parsing information:
<tbody><tr *ngFor="let item of mf.data"><td ><span>{{item.deliveryDate | date: 'MM-dd-yyyy'}}</span></td></tr></tbody>
I have Date Format like "01-03-2018". but the angular2-datable is not sorting correctly. the date is sorting based on the first digit.