Skip to content

campaigns: Add locales to BurndownChart props

Administrator requested to merge aharvey/burndown-test-locale-independence into master

Created by: LawnGnome

This was something I noticed while updating the snapshots in #11035.

We use Intl.DateTimeFormat to localise dates when displaying them in the burndown chart X axis, but date order is inconsistent in different locales: for example, "November 13" in en-US becomes "13 November" in en-AU. To make the snapshot tests more robust, we should be able to control which locale is used, while falling back to the system locale by default.

I'm not really convinced that this is the actual best approach, and would appreciate feedback as a relative dilettante in the world of TypeScript and React: localisation feels like a cross cutting concern that might need a more global approach, and I don't really like the React hooks to make the callbacks work, but this was the minimal set of changes I needed to get things to work reliably in my home locale of en_AU.UTF-8.

Merge request reports

Loading