src/LocalDateRange.php
public static function from(DateTimeParseResult $result) : LocalDateRange
    {
        $startDate = LocalDate::from($result);

        if ($result->hasField(Field\MonthOfYear::NAME)) {
            if ($result->hasField(Field\Year::NAME)) {
                $endDate = LocalDate::from($result);
            } else {
                $endDate = MonthDay::from($result)->atYear($startDate->getYear());
            }
        } else {
            $endDate = $startDate->withDay((int) $result->getField(Field\DayOfMonth::NAME));
        }

        return LocalDateRange::of($startDate, $endDate);
    }
public static function from(DateTimeParseResult $result) : LocalDateRange
    {
        $startDate = LocalDate::from($result);

        if ($result->hasField(Field\MonthOfYear::NAME)) {
            if ($result->hasField(Field\Year::NAME)) {
                $endDate = LocalDate::from($result);
            } else {
                $endDate = MonthDay::from($result)->atYear($startDate->getYear());
            }
        } else {
            $endDate = $startDate->withDay((int) $result->getField(Field\DayOfMonth::NAME));
        }

        return LocalDateRange::of($startDate, $endDate);
    }
public static function from ( DateTimeParseResult $ result ) : LocalDateRange { $ startDate = LocalDate :: from ( $ result ) ; if ( $ result -> hasField ( Field \ MonthOfYear :: NAME ) ) { if ( $ result -> hasField ( Field \ Year :: NAME ) ) { $ endDate = LocalDate :: from ( $ result ) ; } else { $ endDate = MonthDay :: from ( $ result ) -> atYear ( $ startDate -> getYear ( ) ) ; } } else { $ endDate = $ startDate -> withDay ( ( int ) $ result -> getField ( Field \ DayOfMonth :: NAME ) ) ; } return LocalDateRange :: of ( $ startDate , $ endDate ) ; }
Obtains an instance of `LocalDateRange` from a set of date-time fields.

This method is only useful to parsers.

@param DateTimeParseResult $result

@return LocalDateRange

@throws DateTimeException      If the date range is not valid.
@throws DateTimeParseException If required fields are missing from the result.
Obtains an instance of LocalDateRange from a set of date - time fields .