maxDate was not correct.

The calculation of maximum date was done incorrectly. Moreover, I have cleaned up a few unit tests (the messages didn't add any value).

@emanuelez @cmelchior @bmunkholm