MichaelKohler/HelperTools — pull request #15 by ihcsim (2012-12-19 18:52:24+00:00)
Title: CalendarHelper To Generate Dates And DateTimes

Hi Michael,

I've added a `CalendarHelper` class to provide convenient methods to generate dates and datetimes based on the `java.util.GregorianCalendar`. The validation methods I added will help to guard against the side-effects associated with calling the `java.util.GregorianCalendar` constructors straight-up.

Specifically,

* The `CalendarHelper.dates` and `CalendarHelper.datetimes` methods will guard against nonsense dates and times values such as zeros and negatives, the 13th-month of the year, the 32nd-day of the month, the29th-day in February in non-leap years etc. The `java.util.GregorianCalendar` constructors seems to accept all these nonsense values anyway and return `java.util.Date` objects that 'makes sense'. I dislike this kind of side-effects.
* The `java.util.GregorianCalendar` constructors also use a 0-based month value, which annoys me to no end. The `CalendarHelper` will accept months in the range of 1 - 12.

Feel free to merge if you think they are useful. Have a good week.