src/Carbon/CarbonPeriod.php
protected static function addMissingParts($source, $target)
    {
        $pattern = '/'.preg_replace('/[0-9]+/', '[0-9]+', preg_quote($target, '/')).'$/';

        $result = preg_replace($pattern, $target, $source, 1, $count);

        return $count ? $result : $target;
    }
protected static function addMissingParts($source, $target)
    {
        $pattern = '/'.preg_replace('/[0-9]+/', '[0-9]+', preg_quote($target, '/')).'$/';

        $result = preg_replace($pattern, $target, $source, 1, $count);

        return $count ? $result : $target;
    }
protected static function addMissingParts ( $ source , $ target ) { $ pattern = '/' . preg_replace ( '/[0-9]+/' , '[0-9]+' , preg_quote ( $ target , '/' ) ) . '$/' ; $ result = preg_replace ( $ pattern , $ target , $ source , 1 , $ count ) ; return $ count ? $ result : $ target ; }
Add missing parts of the target date from the soure date.

@param string $source
@param string $target

@return string
Add missing parts of the target date from the soure date .