Skip to content

Commit

Permalink
UTC Calendar fix
Browse files Browse the repository at this point in the history
  • Loading branch information
foralost committed Mar 4, 2024
1 parent ab86cee commit 10074de
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,16 @@ 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 {
val gregCalendar = GregorianCalendar(year, month, dayOfMonth)
gregCalendar.timeZone = TimeZone.getTimeZone("UTC")
return gregCalendar
}

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),
Expand Down

0 comments on commit 10074de

Please sign in to comment.