I have a Kotlin function to get the total number of weeks in a month
Code
fun getTotalWeeksInMonth(instant: Instant): Int {
val calendar = Calendar.getInstance()
calendar.time = Date.from(instant)
return calendar.getActualMaximum(Calendar.WEEK_OF_MONTH)
}
However this is using a mix of the old Java date/time APIs (Date and Calendar) and the new APIs (Instant)
How would I achieve the same result, using just the new APIs?