getActualMaximum function returns the non-existent value in kotlin

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Jason
Guest

The java.util.Calendar class is notoriously difficult to use, so much so that Joda-Time was independently developed and then officially adapted/adopted into the java.time package (with some small modifications from the original developer). Here, the problem you have with Calendar is that JANUARY is a constant 0. So, when you use a 6 for Calendar.MONTH that is JULY. There are 31 days in July 2020. Don’t use the Calendar class if you can avoid it. The java.time API is far more consistent. If you can’t avoid using Calendar, use the provided constants – for example, it.set(Calendar.MONTH, Calendar.JUNE) But, even if you’re… Read more »