def _get_period_range_for_single_date(self, date_from, date_to):
        handler = DateHandler(date_from, {},
                              self.answer_store,
                              self.metadata,
                              location=self.location)
        from_min_period_date = handler.get_date_value("minimum")
        from_max_period_date = handler.get_date_value("maximum")

        handler.answer_schema = date_to
        to_min_period_date = handler.get_date_value("minimum")
        to_max_period_date = handler.get_date_value("maximum")

        min_period_date = from_min_period_date or from_max_period_date
        max_period_date = to_max_period_date or to_min_period_date

        # Work out the largest possible range, for date range question
        period_range = max_period_date - min_period_date

        return period_range
    def _get_period_range_for_single_date(
        self,
        date_from: Mapping[str, dict],
        date_to: Mapping[str, dict],
    ) -> timedelta:

        list_item_id = self.location.list_item_id if self.location else None
        value_source_resolver = ValueSourceResolver(
            answer_store=self.answer_store,
            list_store=self.list_store,
            metadata=self.metadata,
            response_metadata=self.response_metadata,
            schema=self.schema,
            location=self.location,
            list_item_id=list_item_id,
            escape_answer_values=False,
        )

        rule_evaluator = RuleEvaluator(
            schema=self.schema,
            answer_store=self.answer_store,
            list_store=self.list_store,
            metadata=self.metadata,
            response_metadata=self.response_metadata,
            location=self.location,
        )

        handler = DateHandler(date_from, value_source_resolver, rule_evaluator,
                              error_messages)

        min_period_date = handler.get_date_value(
            "minimum") or handler.get_date_value("maximum")
        handler.answer_schema = date_to
        max_period_date = handler.get_date_value(
            "maximum") or handler.get_date_value("minimum")

        if not min_period_date or not max_period_date:
            raise ValueError("Period range must have a start and end date")

        # Work out the largest possible range, for date range question
        period_range = max_period_date - min_period_date

        return period_range