Skip to content

Commit

Permalink
fix(pinia-orm): Ordering sometimes wrong with Query.orderBy and UseCo…
Browse files Browse the repository at this point in the history
…llect.sortBy (#1957)

* fix(pinia-orm): Ordering sometimes wrong with Query.orderBy and UseCollect.sortBy

* refactor(pinia-orm): linting
  • Loading branch information
CodeDredd authored Nov 26, 2024
1 parent 3d6c378 commit a5a2c93
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/pinia-orm/src/support/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export function orderBy<T extends Element> (
const result = collection.map<SortableArray<T>>((value) => {
const criteria = iteratees.map((iteratee) => {
if (typeof iteratee === 'function') { return iteratee(value) }
if (!iteratee.includes('.') && !isDate(value[iteratee])) { return value[iteratee] }
const newValue = getValue(value, iteratee, false)
return isDate(newValue) ? new Date(newValue).getTime() : newValue
})
Expand Down

0 comments on commit a5a2c93

Please sign in to comment.