Problem when sorting date in a smart Table (Angular)

173 Views Asked by At

I have a smart table and I try to sort the table by Start Date(column). It is working but it is just sorting data by day and not all the date. This means it is only comparing between the day of the different dates and not all the date (month and year). I'm thinking of using a function here but what option do need to use?CompareFunction maybe? And how i can say the first click ascendant and the second is descendant?

startDate: {
    title: this.applyTransalte("StartDate"),
    type: 'date',
    valuePrepareFunction: (startDate) => {
        return this.datepipe.transform(startDate, 'dd/MM/yyyy');

    },
},
1

There are 1 best solutions below

1
qannouf oualid On

Use yyyy/MM/dd instead because comparing is done alphabetically