Datetime fixes part 1

Merge these changes early so that we have tests to cover this behavior before we look into the deeper datetime issues mentioned in #32.

(sorry everyone for breaking all your pull requests, but we're fixing stuff now, one testcase at a time)