src/Charcoal/Cms/Support/Helpers/DateHelper.php
private function getDateCase()
    {
        $from = $this->from;
        $to = $this->to;

        // single date event
        if (!$to || $to->format('Ymd') === $from->format('Ymd')) {
            return 'single';
        }

        $fromDate = [
            'day'   => $from->format('d'),
            'month' => $from->format('m'),
            'year'  => $from->format('y')
        ];

        $toDate = [
            'day'   => $to->format('d'),
            'month' => $to->format('m'),
            'year'  => $to->format('y')
        ];

        $case = null;
        $case = $fromDate['day'] !== $toDate['day'] ? 'different_day' : $case;
        $case = $fromDate['month'] !== $toDate['month'] ? 'different_month' : $case;
        $case = $fromDate['year'] !== $toDate['year'] ? 'different_year' : $case;

        return $case;
    }
private function getDateCase()
    {
        $from = $this->from;
        $to = $this->to;

        // single date event
        if (!$to || $to->format('Ymd') === $from->format('Ymd')) {
            return 'single';
        }

        $fromDate = [
            'day'   => $from->format('d'),
            'month' => $from->format('m'),
            'year'  => $from->format('y')
        ];

        $toDate = [
            'day'   => $to->format('d'),
            'month' => $to->format('m'),
            'year'  => $to->format('y')
        ];

        $case = null;
        $case = $fromDate['day'] !== $toDate['day'] ? 'different_day' : $case;
        $case = $fromDate['month'] !== $toDate['month'] ? 'different_month' : $case;
        $case = $fromDate['year'] !== $toDate['year'] ? 'different_year' : $case;

        return $case;
    }
private function getDateCase ( ) { $ from = $ this -> from ; $ to = $ this -> to ; // single date event if ( ! $ to || $ to -> format ( 'Ymd' ) === $ from -> format ( 'Ymd' ) ) { return 'single' ; } $ fromDate = [ 'day' => $ from -> format ( 'd' ) , 'month' => $ from -> format ( 'm' ) , 'year' => $ from -> format ( 'y' ) ] ; $ toDate = [ 'day' => $ to -> format ( 'd' ) , 'month' => $ to -> format ( 'm' ) , 'year' => $ to -> format ( 'y' ) ] ; $ case = null ; $ case = $ fromDate [ 'day' ] !== $ toDate [ 'day' ] ? 'different_day' : $ case ; $ case = $ fromDate [ 'month' ] !== $ toDate [ 'month' ] ? 'different_month' : $ case ; $ case = $ fromDate [ 'year' ] !== $ toDate [ 'year' ] ? 'different_year' : $ case ; return $ case ; }
Get the usage case by comparing two dates.
@return string
Get the usage case by comparing two dates .