bitwalker/timex — pull request #22 by nmnowak (2014-11-23 15:53:03+00:00)
Title: Changed Time.to_(12/24)hour_clock functions to properly handle the 0 hou...

...r.

Fixed bugs related to time conversions revolving around the 0 hour. Previously
to_12hour_clock converted the 0 hour to 12 pm instead of 12 am. Similarily,
to_24hour_clock converted 12 pm to the 0 hour when it should be converted to
hour 12.

Also the gaurd clause for to_24hour_clock was changed to no longer accept :AM
and :PM. These cases were not handled in the body of the function so the code
would simply crash if they were every used. Since, all unit tests pass after
removing :AM and :PM I assume they are not needed. Removing them doesn't
really change much because the function will still die with a failed pattern
match. The only difference is it will do so a little earlier now.

I also added unit tests for both to_12hour_clock and to_24hour_clock. In
addition, I updated unit tests in format_default_test and
format_strftime_test to work with the updated functions. Previously, several
of the tests had the same error of expecting the 0 hour to be converted to
12 pm instead of 12 am.