Fix and add tests for date merging.