-
-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Labels
Description
Environment
No response
Reproduction
Given the following items:
[
{ name: 'A' },
{ name: 'B' },
{ name: 'Š' },
{ name: 'T' },
{ name: 'U' }
]
Using:
Item.query().orderBy('name', 'asc').get()
Returns:
[ 'A', 'B', 'T', 'U', 'Š' ]
Expected result (Lithuanian alphabetical order):
[ 'A', 'B', 'Š', 'T', 'U' ]
Describe the bug
When using the orderBy() method in pinia-orm, sorting fields that contain non-English characters specifically Lithuanian letters such as "Š" does not respect the correct alphabetical order according to the Lithuanian locale.
Expected Behavior:
Sorting with orderBy() should respect locale-aware collation (e.g., using localeCompare() under the hood, with the option to specify a locale such as 'lt' for Lithuanian).
Workaround:
Currently, the only way to achieve correct sorting is to manually sort the results after .get():
Item.query().get().slice().sort((a, b) =>
a.name.localeCompare(b.name, 'lt')
)
Additional context
No response