I used APIs called LocalDate and LocalDateTime after API level 26 in My App.
When I had this app run on a customer's smartphone, it failed.
When I searched for the cause, the customer's smartphone was API level 23.
LocalDate and LocalDateTime were very useful APIs, so I used them in 151 places.
I use it a lot for comparing dates, adding dates, comparing dates and times, and so on.

I would like a source code that implements LocalDate and LocalDateTime only with APIs of API level 23 or earlier so that this can be used on smartphones with API level 23.

Is there any way to get it?

  • Answer # 1

    There seems to be something like this.
    >ThreeTenABP is, roughly speaking, a library that backports new APIs such as java.time.LocalDate so that they can be used on Android without any problems. The author is our Jake god.
    [Kotlin] Compare two dates with LocalDate and get the difference in the number of days