Matti MK
02/24/2025, 7:35 PMjava.time.format.DateTimeFormatter
, more specifically using Locale.getDefault()
.
When I generate the reference screenshots on my local machine the locale formats dates in DD.M.YYYY
. However, when I run tests on my CI machine it uses the M/DD/YYYY
format. This causes the tests to fail, as now the screenshots look different.
What would be a recommended way to go about this? Of course, providing a Locale as an argument to the Composable would be one option, but I'm wondering if there's a more graceful approach.Michael Krussel
02/24/2025, 7:55 PMLocale.setDefault()
in the test before building the UIMichael Krussel
02/24/2025, 7:57 PMMatti MK
02/24/2025, 8:04 PMMatti MK
02/25/2025, 4:28 PMWrite access not allowed during rendering (user.language)
at com.android.tools.rendering.security.RenderSecurityException.create(RenderSecurityException.java:52)
at com.android.tools.rendering.security.RenderSecurityManager.checkPermission(RenderSecurityManager.java:694)
at java.base/java.util.Locale.setDefault(Locale.java:1110)
at java.base/java.util.Locale.setDefault(Locale.java:1069)
Unfortunately that didn't quite workMatti MK
02/25/2025, 4:29 PMLocale.getDefault()
)..Michael Krussel
02/25/2025, 4:29 PMMatti MK
02/25/2025, 4:32 PMCompositionLocal
, but at the same time I've got very little experience with it so maybe that's why.
I think the date is used in so few places, that the arg with a default parameter seems like an easier approach here.