Clean up and correct prune_split; add tests

The conversion to UTC in the unit test is a bit annoying, but it is needed for the first and last day of a month.  And I guess it indirectly tests the conversion from UTC to local time done in helpers.py.

Feel free to suggest any changes or provide any comments.