[WOOMOB-3725] Follow the locale's date order in analytics date ranges - #16416
[WOOMOB-3725] Follow the locale's date order in analytics date ranges#16416irfano wants to merge 4 commits into
Conversation
|
|
1ff4bd2 to
b899151
Compare
There was a problem hiding this comment.
AI Code Review - Found 1 potential issue
[follow-up] StatsTimeRangeSelectionTest drops the ~11 tests that asserted currentRangeDescription/previousRangeDescription for the year-to-date, last-year, quarter, month, week and custom selection types, leaving no coverage of the new formatAsRangeWith description wiring. The range boundaries are still covered by the retained currentRange/previousRange assertions, and LocalizedDatePatternsTestRule now stubs the ICU APIs, so a representative description test could be restored to guard against formatting regressions. Deferring is defensible since the formatting itself is delegated to ICU.
The rest of the change looks correct: minSdk is 26 so the android.icu DateIntervalFormat/DateInterval APIs are safe to call; the by lazy conversions in the tests correctly defer range-selection construction until after the rule has stubbed the ICU statics (property initializers would otherwise run before @Rule.starting); and the single-day (formatToLocalizedMonthDayYear) vs. multi-day (formatAsRangeWith) paths stay stylistically consistent.
PR housekeeping
- Applied repo
AGENTS.md/CLAUDE.mdguidance (Kotlin, store-app conventions) while reviewing. - Testing: user-facing change is analytics/AI-assistant date-range wording; the updated unit tests assert the new formatted strings via
LocalizedDatePatternsTestRule.
Automatic review · claude-opus-4-8 · Workflow run
How to reply to a finding
Reply on this review (or inline at the line the finding refers to) with one of:
@claude addressed- I made the change. Bot verifies against the next diff before marking resolved.@claude rejected: <reason>- Will not fix; reason gets quoted on the next review.@claude not-applicable- Finding does not apply (wrong file, already covered elsewhere, etc.).
The bot honours these on the next review pass.
@claude rejected: The rule stubs ICU in unit tests, so a restored description test would assert the stub's output, not the formatting. The composition those tests covered moved into ICU, formatAsRangeWith only forwards the two dates and has nothing of its own left to test. |

Fixes WOOMOB-3725
Analytics date ranges were built by formatting the two dates separately and joining them, with the second one shortened when both fell in the same month. That shortening only reads correctly when the month comes first, so the whole range was pinned to the American order: British English showed
Aug 3 – 9, 2026where the language calls for3 – 9 Aug 2026.Description
formatAsRangeWithnow hands both dates to ICU'sDateIntervalFormatwith ayMMMdskeleton. Which part is shortened, where the year lands and which separator is used are all decided per language, so ranges match the single dates fixed in WOOMOB-3262.The AI assistant stats card composed its period the same way and moved over too.
The two date comparison helpers the old composition needed are gone, they had no other callers.
formatAsRangeWithhas no dedicated test: it is a single line handing the two dates to ICU, with no logic of its own to cover. Unit tests stub the interval formatter with a plain full-date join, deliberately not copying ICU's elision, so test expectations pin our wiring rather than ICU's output. The range description tests inStatsTimeRangeSelectionTestare removed with the hand-rolled composition they asserted; the date information tests in the same file keep covering the range boundary math.American English analytics ranges are unchanged: ICU produces the same string the old code did for every same-month, same-year and cross-year case, so the existing assertions still pass untouched. The AI assistant card is the one exception: it used to repeat the month within the same month, so
May 1 – May 7, 2026now readsMay 1 – 7, 2026, same as the analytics screen.Test Steps
Analytics
3 – 9 Aug 2026for Last Week, notAug 3 – 9, 2026.27 Jul – 2 Aug 2026.1 Jan – 31 Dec 2025.Aug 3 – 9, 2026.AI assistant
Images/gif
Emulator with the app language set to English (United Kingdom).
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.