diff --git a/uhabits-core/src/jvmTest/java/org/isoron/uhabits/core/utils/DateUtilsTest.kt b/uhabits-core/src/jvmTest/java/org/isoron/uhabits/core/utils/DateUtilsTest.kt index 19534a5bd..8969e414f 100644 --- a/uhabits-core/src/jvmTest/java/org/isoron/uhabits/core/utils/DateUtilsTest.kt +++ b/uhabits-core/src/jvmTest/java/org/isoron/uhabits/core/utils/DateUtilsTest.kt @@ -120,10 +120,15 @@ class DateUtilsTest : BaseUnitTest() { @Test fun getWeekdaysInMonth() { - val february = GregorianCalendar(2018, Calendar.FEBRUARY, 1) - val leapFebruary = GregorianCalendar(2020, Calendar.FEBRUARY, 1) - val month = GregorianCalendar(2020, Calendar.APRIL, 1) - val longMonth = GregorianCalendar(2020, Calendar.AUGUST, 1) + fun getCalendarUTC(year: Int, month: Int, dayOfMonth: Int) = + GregorianCalendar(year, month, dayOfMonth).apply { + timeZone = TimeZone.getTimeZone("UTC") + } + + val february = getCalendarUTC(2018, Calendar.FEBRUARY, 1) + val leapFebruary = getCalendarUTC(2020, Calendar.FEBRUARY, 1) + val month = getCalendarUTC(2020, Calendar.APRIL, 1) + val longMonth = getCalendarUTC(2020, Calendar.AUGUST, 1) assertThat( arrayOf(4, 4, 4, 4, 4, 4, 4),