Skip to content

Commit

Permalink
fix(VDataTable): convert dates to timestamps before sorting
Browse files Browse the repository at this point in the history
fixes #13829
  • Loading branch information
KaelWD committed Jun 23, 2021
1 parent 4cc80ca commit 3171d6f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/vuetify/src/util/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ export function sortItems<T extends any = any> (
continue
}

// Dates should be compared numerically
if (sortA instanceof Date && sortB instanceof Date) {
return sortA.getTime() - sortB.getTime()
}

[sortA, sortB] = [sortA, sortB].map(s => (s || '').toString().toLocaleLowerCase())

if (sortA !== sortB) {
Expand Down

0 comments on commit 3171d6f

Please sign in to comment.