def _adjust_historical_forecasts_time_index(
    series: TimeSeries,
    series_idx: int,
    historical_forecasts_time_index: TimeIndex,
    start: Optional[Union[pd.Timestamp, float, int]],
    start_format: Literal["position", "value"],
    stride: int,
    show_warnings: bool,
) -> TimeIndex:
    """
    Shrink the beginning and end of the historical forecasts time index based on the value of `start`.
    """
    # retrieve actual start
    # when applicable, shift the start of the forecastable index based on `start`
    if start is not None:
        # find valid start position relative to the hfc start time, otherwise raise an error
        start_idx, start_idx_orig = _get_start_index(
            series=series,
            series_idx=series_idx,
            start=start,
            start_format=start_format,
            stride=stride,
            historical_forecasts_time_index=historical_forecasts_time_index,
        )
        start_time = series._time_index[start_idx]

        if start_idx != start_idx_orig and show_warnings:
            if start_idx_orig >= 0:
                start_time_orig = series._time_index[start_idx_orig]
            else:
                start_time_orig = series.start_time() + start_idx_orig * series.freq

            if start_format == "position" or (
                not isinstance(start, pd.Timestamp) and series._has_datetime_index
            ):
                start_value_msg = (
                    f"position `{start}` corresponding to time `{start_time_orig}`"
                )
            else:
                start_value_msg = f"time `{start_time_orig}`"
            logger.warning(
                f"`start` {start_value_msg} is before the first predictable/trainable historical "
                f"forecasting point for series at index: {series_idx}. Using the first historical forecasting "
                f"point `{start_time}` that lies a round-multiple of `stride={stride}` "
                f"ahead of `start`. To hide these warnings, set `show_warnings=False`."
            )
        historical_forecasts_time_index = (
            max(historical_forecasts_time_index[0], start_time),
            historical_forecasts_time_index[1],
        )
    return historical_forecasts_time_index

    Shrink the beginning and end of the historical forecasts time index based on the value of `start`.
    
darts/utils/historical_forecasts/utils.py