[MBL-19735][All] Respect device first day of week setting in calendar and to-do#3534
Conversation
There was a problem hiding this comment.
Review Summary
This PR centralizes first-day-of-week logic to use the system locale settings instead of WeekFields.of(Locale.getDefault()). The approach is good and the test mocking is appropriate, but there's a critical type mismatch issue that will prevent compilation.
Issues Found
- Critical: Type mismatch in LocaleUtils.kt:30,105-113 - Using
java.time.DayOfWeekinstead oforg.threeten.bp.DayOfWeek. The codebase uses ThreeTenBP throughout, and these types are not interchangeable. This will cause compilation errors.
Positive Aspects
✅ Good refactoring approach - Centralizing the first-day-of-week logic into utility functions makes the code more maintainable and testable
✅ Comprehensive changes - All usages of WeekFields.of(Locale.getDefault()) have been properly replaced across the codebase (CalendarComponents.kt, CalendarStateMapper.kt, CreateUpdateEventViewModel.kt, ForecastWidgetViewModel.kt, ToDoFilterUiState.kt)
✅ Proper test mocking - The test files correctly mock getSystemLocaleCalendar() to ensure consistent behavior during testing
✅ Good abstraction - The getSystemLocaleCalendar() function properly handles the device locale extraction using ConfigurationCompat
Recommendation
Please fix the type mismatch issue by changing the import from java.time.DayOfWeek to org.threeten.bp.DayOfWeek and updating the return values in the when expression accordingly. Once this is corrected, the PR will be ready to merge.
libs/pandautils/src/main/java/com/instructure/pandautils/utils/LocaleUtils.kt
Show resolved
Hide resolved
libs/pandautils/src/main/java/com/instructure/pandautils/utils/LocaleUtils.kt
Show resolved
Hide resolved
🧪 Unit Test Results✅ 📱 Parent App
✅ 📱 Student App
✅ 📱 Teacher App
✅ 🌅 Horizon
✅ 📦 Submodules
📊 Summary
Last updated: Wed, 18 Feb 2026 12:07:09 GMT |
…r-and-To-do # Conflicts: # libs/pandautils/src/main/java/com/instructure/pandautils/features/dashboard/widget/forecast/ForecastWidgetViewModel.kt
📊 Code Coverage Report✅ Student
✅ Teacher
|
Test plan:
refs: MBL-19735
affects: Student, Teacher, Parent
release note: Calendar and to-do lists now respect your device's first day of week setting
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com