Nils Sommer

Last week, a code contribution I wrote was merged into an open source project for the first time. The patch was pretty simple, nevertheless it feels great to give back, even if it's only something small.

I've been working on a Java based project for a student class lately that requires to read timestamps from ISO 8601 formatted strings. For Java, joda-time has long been the de facto standard library for date and time stuff. With Java 8, large parts of joda-time have been included into the JDK. One of the classes that are part of joda-time, Interval, wasn't included into java.time. The project threeten-extra contains a set of classes, such as Interval, that complement those from the JDK 8.

To keep the dependency hell as small as possible, I was using threeten-extra as an extension of the java.time classes rather than the larger joda-time. I quickly stumbled upon a case where the Interval class from threeten-extra didn't work as expected (the joda-time equivalent did): Parsing ISO 8601 intervals with time zone offsets couldn't be parsed.

UTC start/end interval worked:

Time zone offsets for start/end didn't work:

I filed a bug report and the maintainer happily suggested a solution. I implemented the two line fix and opened a pull request that was merged shortly after that.

Feels good.

Write a comment