Implement valid_before() and valid_after().