ocpsoft / prettytime

Social Style Date and Time Formatting for Java
http://ocpsoft.org/prettytime/
Apache License 2.0
1.29k stars 253 forks source link

Use Java 8 APIs. #200

Closed Isira-Seneviratne closed 3 years ago

Isira-Seneviratne commented 3 years ago

Make use of features added in Java 8, and add methods that accept the java.time date/time types.

This fixes https://github.com/ocpsoft/prettytime/issues/109.

lincolnthree commented 3 years ago

Hey @Isira-Seneviratne . Thank you so very much for this pull request! This is a fantastic update. I'll need some time to review and make sure everything is in order, but at first glance this is amazing.

I really appreciate you putting the effort into updating the APIs for Java 8 (something I've long wanted to do but haven't had much time for.)

lincolnthree commented 3 years ago

This PR looks great. I did some additional cleanup of failing tests that had been accumulating over time from various PRs and code rot. I also cleaned up the imports to not use the * import, which can cause unnecessary classloading.

Lastly, I did some additional code cleanup to fix compiler warnings for unused or redundant super interfaces and other issues.

The project has also been updated to compile and use Java 1.8 as a minimum requirement.

Since the changes are not entirely backwards compatible (unless I am mistaken), this release will bump the PrettyTime major version to 5.0.0, a major milestone!

lincolnthree commented 3 years ago

@Isira-Seneviratne I've added you as a developer in the pom.xml -- THANK you for this major contribution.

Isira-Seneviratne commented 3 years ago

Happy to help :)

Isira-Seneviratne commented 3 years ago

On another note, putIfAbsent isn't supported on Android API levels below 24, so that'd need to be changed for prettytime 4.x.

lincolnthree commented 3 years ago

Interesting. Do you think that's worth a patch release? Android < 24 is quite dated at this point.

Isira-Seneviratne commented 3 years ago

Yeah, but most apps have a minSdkVersion below 24 to be compatible with as many devices as possible.