Re #8638. Add missing unit test for endTime.

Including testing for yet-to-be-implemented behaviour when the end time
string is not well-formed.
Re #8638. Refactor to catch misformed times.