const arr = [
{
id: 1,
dateFilters: "01.01.2021",
},
{
id: 2,
dateFilters: "05.05.2021",
},
{
id: 3,
dateFilters: "03.03.2020",
},
{
id: 4,
dateFilters: "12.12.2020",
},
{
id: 5,
dateFilters: "24.11.2020",
},
];
sort()
. const arr = [
{
id: 1,
dateFilters: "01.01.2021",
},
{
id: 2,
dateFilters: "05.05.2021",
},
{
id: 3,
dateFilters: "03.03.2020",
},
{
id: 4,
dateFilters: "12.12.2020",
},
{
id: 5,
dateFilters: "24.11.2020",
},
];
const result = arr
.map(d => ({...d, dateFilters: new Date(d.dateFilters.split('.').reverse().join('.'))}))
.sort((a, b) => b.dateFilters - a.dateFilters)