meteo-core/src/main/java/no/api/meteo/service/locationforecast/extras/LocationForecastHelper.java
public Optional<MeteoExtrasForecast> findNearestForecast(ZonedDateTime dateTime) {
        ZonedDateTime dt = toZeroMSN(dateTime.withZoneSameInstant(METZONE));
        PointForecast chosenForecast = null;
        for (Forecast forecast : getLocationForecast().getForecasts()) {
            if (forecast instanceof PointForecast) {
                PointForecast pointForecast = (PointForecast) forecast;
                if (isDateMatch(dt, cloneZonedDateTime(pointForecast.getFrom()))) {
                    chosenForecast = pointForecast;
                    break;
                } else if (chosenForecast == null) {
                    chosenForecast = pointForecast;
                } else if (isNearerDate(pointForecast.getFrom(), dt, chosenForecast.getFrom())) {
                    chosenForecast = pointForecast;
                }
            }
        }
        if (chosenForecast == null) {
            return Optional.empty();
        }
        return Optional.of(
                new MeteoExtrasForecast(
                        chosenForecast,
                        getIndexer().getWidestFitPeriodForecast(chosenForecast.getFrom()).orElse(null)));
    }
public Optional<MeteoExtrasForecast> findNearestForecast(ZonedDateTime dateTime) {
        ZonedDateTime dt = toZeroMSN(dateTime.withZoneSameInstant(METZONE));
        PointForecast chosenForecast = null;
        for (Forecast forecast : getLocationForecast().getForecasts()) {
            if (forecast instanceof PointForecast) {
                PointForecast pointForecast = (PointForecast) forecast;
                if (isDateMatch(dt, cloneZonedDateTime(pointForecast.getFrom()))) {
                    chosenForecast = pointForecast;
                    break;
                } else if (chosenForecast == null) {
                    chosenForecast = pointForecast;
                } else if (isNearerDate(pointForecast.getFrom(), dt, chosenForecast.getFrom())) {
                    chosenForecast = pointForecast;
                }
            }
        }
        if (chosenForecast == null) {
            return Optional.empty();
        }
        return Optional.of(
                new MeteoExtrasForecast(
                        chosenForecast,
                        getIndexer().getWidestFitPeriodForecast(chosenForecast.getFrom()).orElse(null)));
    }
Get the most accurate forecast for the given date.

@param dateTime
The date to get the forecast for.

@return Optional containing the forecast if found, else {@link Optional#empty()}