Fix custom date range muddle when groupby weeks

.. the start date would progressively change as you selected a
date range in the sidebar. This is because the code to set the date
range to the start of a week looked at the wrong date variable when
using a custom date range.

Fixes #500.