Hey all. I was looking around the Chart component runtime today trying to understand more of that subsystem, and noticed something that felt off. sharing here before it gets lost in my notes.
three files under components/runtime/:
AxisChartView.javaBarChartDataModel.javaPointChartDataModel.java
There are six new SimpleDateFormat("yyyy-MM-dd") / "HH:mm:ss" / "dd/MM/yyyy" calls across them, none of which pass a Locale. When no Locale is passed java uses Locale.getDefault(), which is the device locale at runtime. it sounds harmless but there are two java quirks that make it not:
-
on a Thai-locale device,
SimpleDateFormat'sypattern character resolves againstBuddhistCalendar, not Gregorian. Buddhist year = Gregorian + 543, so a date in 2026 renders as2569-04-17. axis labels inAxisChartViewjump 500 years into the future, and the date-string parsing inBarChartDataModel/PointChartDataModelbreaks because the user's"2026-04-17"input stops matching the now-Buddhist-calendar pattern. -
on locales with non-Western digit shaping (Arabic, Persian, Myanmar etc.), the
MM/dd/HH/mm/sscharacters render in the local script. not inherently a bug, but MPAndroidChart renders its own numeric axis ticks in Western digits, so you end up with mixed scripts on the same axis. looks off.
I opened PR #3891 against ucr with the fix. Passes Locale.US explicitly to all six constructors. 3 files, 9 insertions, 6 edits. It's a tiny change. The template is filled out; now I'm waiting on CLA check and review.
Two things i'm not sure about and would love a second opinion on:
-
Locale.USvsLocale.ROOT. i went with US because that's what most android i18n guidance seems to use for ISO-style format strings, but ROOT is arguably more neutral. is there a preferred convention in the App Inventor codebase? I grep'd around and couldn't find a consistent pattern either way. -
has anyone actually seen the Thai symptom in a bug report? Couldn't find anything in the issue tracker but my search-fu isn't perfect. If there's an existing issue i should link to the PR, a pointer would be appreciated.
also, i only touched Android this round. didn't examine components-ios/. if someone familiar with that side knows whether the same pattern lives there, happy to file a follow-up. Didn't want to bundle it into a mega-PR before the android side even gets a look.
Thanks for reading.
- apex