Skip to content

Commit a5a2c93

Browse files
authored
fix(pinia-orm): Ordering sometimes wrong with Query.orderBy and UseCollect.sortBy (#1957)
* fix(pinia-orm): Ordering sometimes wrong with Query.orderBy and UseCollect.sortBy * refactor(pinia-orm): linting
1 parent 3d6c378 commit a5a2c93

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/pinia-orm/src/support/Utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export function orderBy<T extends Element> (
8383
const result = collection.map<SortableArray<T>>((value) => {
8484
const criteria = iteratees.map((iteratee) => {
8585
if (typeof iteratee === 'function') { return iteratee(value) }
86+
if (!iteratee.includes('.') && !isDate(value[iteratee])) { return value[iteratee] }
8687
const newValue = getValue(value, iteratee, false)
8788
return isDate(newValue) ? new Date(newValue).getTime() : newValue
8889
})

0 commit comments

Comments
 (0)