Skip to content

localeCompare is wrong in Android vs iOS #12597

Closed
@maraujop

Description

@maraujop

Description

It seems that localeCompare works differently in iOS and Android. In Android it doesn't return the expected value.

Reproduction

'a'.localeCompare('A', 'es', { sensitivity: 'base', caseFirst: false })

In Google Chrome in Mac returns 0
in Android 6.0.1 react-native (device and emulator) returns 1
in iOS 10.2 react-native returns 0

It's my understanding that localeCompare is not reliable in Android for anything that is not English. I don't know if this is an error in v8 engine, but I believe this was patched in v8-i18n, so not sure if this can be fixed in RN or not

Additional Information

  • React Native version: 0.39.2
  • Platform: Android 6.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions