I’ve started on the re-implementation of command-line java calendar tool in order to provide support for relative dates and other features, and while working on it I got a bit carried away with implementation of what turned out to be no less that custom dates API+implementation.
It’s pretty basic, and was done more as an exercise than for any particular need, but still I believe some interesting concepts can be looked up from it.
Though not yet complete, the code of JCCal was already committed to GitHub: https://github.com/mvmn/jccal . The dates API+impl classes can be looked up there already (in package x.mvmn.util.dates). Please also check the README there for general explanations.
I won’t be doing much explanation here, since it would mostly be copy-pasting of the readme for general things, and copypasting of actual code for the details. As someone said, “The truth is in the code” – so I encourage anyone who is interested to actually look up the code.