The issue is caused by failing to correctly take the daylight saving time into account - internally we use UTC time to represent dates, however when generating month titles we try to calculate the time difference of the UTC time and the local time, which can result in off-by-one errors when the first day of the month is also the first day of the daylight saving time, e.g., April 1, 1979 in Poland.
Fixes this by always using UTC time to generate month titles. Also clears the relevant implementation for a little bit since context is actually not required when we only need to format years and months.
Resolves https://github.com/material-components/material-components-android/issues/1935
PiperOrigin-RevId: 413505587
- was copying year/month/date fields between Calendar objects in different time zones.
- convert input Calendar object into a Calendar object in UTC, then copy year/month/date fields to the return Calendar object.
PiperOrigin-RevId: 284597830