After upgrading to iOS 18, I noticed a Fitbit app I'd made stopped receiving data updates from the companion app. On investigating the issue, I discover the issue was Javascript Date().toLocaleString() throwing an error due to the language tag being fetched from the Companion user-settings API's locale.language not complying with the BCP 47 spec. The tag returned on my device by the Fitbit API was en_FI, which is not a valid BCP tag - this language pair is not supported in BCP and even the official BCP tag separator is different (underscore vs dash).
I don't have an older iOS device available so I can't validate if the issue is with Javascript Date().toLocaleString() behaviour becoming more strict in iOS 18, or if the API used by Fitbit to generate the locale tag has changed, but the net effect is that the locale value supplied by the user-settings is no longer always recognised by the Javascript API.
I added a workaround to my app to try/catch the Javascript Date().toLocaleString() call throwing an error and defaulting to en-EN if the Fitbit supplied tag is not working, but this is probably affecting a variety of apps and should be fixed.
After upgrading to iOS 18, I noticed a Fitbit app I'd made stopped receiving data updates from the companion app. On investigating the issue, I discover the issue was Javascript
Date().toLocaleString()throwing an error due to the language tag being fetched from the Companionuser-settingsAPI'slocale.languagenot complying with the BCP 47 spec. The tag returned on my device by the Fitbit API wasen_FI, which is not a valid BCP tag - this language pair is not supported in BCP and even the official BCP tag separator is different (underscore vs dash).I don't have an older iOS device available so I can't validate if the issue is with
Javascript Date().toLocaleString()behaviour becoming more strict in iOS 18, or if the API used by Fitbit to generate the locale tag has changed, but the net effect is that the locale value supplied by the user-settings is no longer always recognised by the Javascript API.I added a workaround to my app to try/catch the Javascript
Date().toLocaleString()call throwing an error and defaulting toen-ENif the Fitbit supplied tag is not working, but this is probably affecting a variety of apps and should be fixed.