Ensure we invalidate the cache if the date has changed

This does involve an extra `substr` call, but should not have a noticeable impact on performance.