Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Allow sorting with numeric value #691

Merged
merged 1 commit into from
Aug 20, 2021

Conversation

akashgp09
Copy link
Contributor

@akashgp09 akashgp09 commented Aug 18, 2021

Problem

#690 (comment)

Solution

Pass {numeric: true} option to localeCompare.

Numeric sorting

// by default, "2" > "10"
console.log("2".localeCompare("10")); // 1

// numeric using options:
console.log("2".localeCompare("10", undefined, {numeric: true})); // -1

Areas of Impact

https://github.com/bookbrainz/bookbrainz-site/blob/series-entity/src/common/helpers/utils.ts

@akashgp09 akashgp09 changed the title FIX: Allow sorting of numeric value FIX: Allow sorting with numeric value Aug 18, 2021
Copy link
Contributor

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@MonkeyDo MonkeyDo merged commit aae172b into metabrainz:series-entity Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants