public static function getDateWithMinOffsetFromToday($target, $workdayMinOffset, $inputFormat = 'd.m.Y', $today = null)
    {
        $targetDateObj = \DateTime::createFromFormat($inputFormat,$target);

        $earliestDate = self::getDateWithOffset($workdayMinOffset, $today, $inputFormat);

        if($targetDateObj === false || $earliestDate === false)
            return false;

        $earliestDateObj = new \DateTime($earliestDate);

        $isTargetDay = self::dateIsTargetDay($targetDateObj);
        while( !$isTargetDay )
        {
            $targetDateObj->modify('+1 day');
            $isTargetDay = self::dateIsTargetDay($targetDateObj);
        }

        if(strcmp($targetDateObj->format('Y-m-d'),$earliestDateObj->format('Y-m-d')) > 0)      // target > earliest?
            return $targetDateObj->format('Y-m-d');
        else
            return $earliestDateObj->format('Y-m-d');
    }
public static function getDateWithMinOffsetFromToday($target, $workdayMinOffset, $inputFormat = 'd.m.Y', $today = null)
    {
        $targetDateObj = \DateTime::createFromFormat($inputFormat,$target);

        $earliestDate = self::getDateWithOffset($workdayMinOffset, $today, $inputFormat);

        if($targetDateObj === false || $earliestDate === false)
            return false;

        $earliestDateObj = new \DateTime($earliestDate);

        $isTargetDay = self::dateIsTargetDay($targetDateObj);
        while( !$isTargetDay )
        {
            $targetDateObj->modify('+1 day');
            $isTargetDay = self::dateIsTargetDay($targetDateObj);
        }

        if(strcmp($targetDateObj->format('Y-m-d'),$earliestDateObj->format('Y-m-d')) > 0)      // target > earliest?
            return $targetDateObj->format('Y-m-d');
        else
            return $earliestDateObj->format('Y-m-d');
    }
public static function getDateWithMinOffsetFromToday ( $ target , $ workdayMinOffset , $ inputFormat = 'd.m.Y' , $ today = null ) { $ targetDateObj = \ DateTime :: createFromFormat ( $ inputFormat , $ target ) ; $ earliestDate = self :: getDateWithOffset ( $ workdayMinOffset , $ today , $ inputFormat ) ; if ( $ targetDateObj === false || $ earliestDate === false ) return false ; $ earliestDateObj = new \ DateTime ( $ earliestDate ) ; $ isTargetDay = self :: dateIsTargetDay ( $ targetDateObj ) ; while ( ! $ isTargetDay ) { $ targetDateObj -> modify ( '+1 day' ) ; $ isTargetDay = self :: dateIsTargetDay ( $ targetDateObj ) ; } if ( strcmp ( $ targetDateObj -> format ( 'Y-m-d' ) , $ earliestDateObj -> format ( 'Y-m-d' ) ) > 0 ) // target > earliest? return $ targetDateObj -> format ( 'Y-m-d' ) ; else return $ earliestDateObj -> format ( 'Y-m-d' ) ; }
Returns the target date, if it has at least the given offset of TARGET2 days form today. Else
the earliest date that respects the offset is returned.

@param string $target
@param int    $workdayMinOffset
@param string $inputFormat
@param string $today
@return string
Returns the target date if it has at least the given offset of TARGET2 days form today . Else the earliest date that respects the offset is returned .