Rewrites dateindex algorithm and adds tests to prove it's results. Fixes a number of issues with date displays