Fixing parsing of midnight and noon with specified period

Parsing "12 AM" currently fails with a result of 12:00:00 instead of 00:00:00.
Parsing "12 PM" currently fails with an exception that the hour must be 0..23.

Fixed and added tests.