fponticelli/thx — pull request #18 by jasononeil (2013-03-29 05:13:08+00:00)
Title: More Haxe3 changes, updates to Dates.hx and FormatDate.hx

This is a pretty big pull request. It includes enough fixes to get the unit tests compiling for Haxe3.

On Neko, the unit tests currently give as follows:

assertations: 1755
successes: 1719
errors: 0
failures: 36
warnings: 0
execution time: 0.11

The failures are in `thx.svg.TestLine` and `thx.svg.TestArea`, as well as one failure in `thx.date.TestDateParser`, but I'm pretty sure that is a glitch in neko for my platform, and I've submitted [an issue](http://code.google.com/p/haxe/issues/detail?id=1664). I haven't run unit tests on other platforms yet.

I've also made a bunch of changes to Dates and FormatDate, namely:

* Added some inline code documentation
* Change FormatDate.format() to take the date first, so it works with "using"
* Change Dates.format() to pass to FormatDate.format() if one of the pre-listed strings is not used.
* Fixes to Dates.snapToWeekDay(), it didn't appear to work well to me. It now also supports snapping forward, backward, or to the current week (in which case, you can specify which day is the start of the week)
* Added to Dates: `isLeapYear(int)`, `isInLeapYear(date)`, `numDaysInMonth(month, year)`, `numDaysInThisMonth(date)`, `deltaSec`, `deltaMin`, `deltaHour`, `deltaDay`, `deltaWeek`, `deltaMonth`, `deltaYear`, (prev/next)(year/month/week/day),
* Added to FormatDate: `dateYMD()`, `dateShortTimeShort()`, `dateShortTime()`, `dateTimeShort()`
* Fixed monthName and monthNameShort, they were the wrong way around. Same for weekDay and weekDayNameShort.
* Added "DateTools" and "FormatDate" aliases so that their functions are available through "using"

If you are interested in having only the haxe3 changes and not the new Dates/FormatDate features, I can create separate pull requests...