source/Application/Model/Voucher.php
protected function _isValidDate()
    {
        $oSeries = $this->getSerie();
        $iTime = time();

        // If date is not set will add day before and day after to check if voucher valid today.
        $iTomorrow = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"));
        $iYesterday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));

        // Checks if beginning date is set, if not set $iFrom to yesterday so it will be valid.
        $iFrom = ((int) $oSeries->oxvoucherseries__oxbegindate->value) ?
            strtotime($oSeries->oxvoucherseries__oxbegindate->value) : $iYesterday;

        // Checks if end date is set, if no set $iTo to tomorrow so it will be valid.
        $iTo = ((int) $oSeries->oxvoucherseries__oxenddate->value) ?
            strtotime($oSeries->oxvoucherseries__oxenddate->value) : $iTomorrow;

        if ($iFrom < $iTime && $iTo > $iTime) {
            return true;
        }

        $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
        $oEx->setMessage('MESSAGE_COUPON_EXPIRED');
        if ($iFrom > $iTime && $iTo > $iTime) {
            $oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
        }
        $oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
        throw $oEx;
    }
protected function _isValidDate()
    {
        $oSeries = $this->getSerie();
        $iTime = time();

        // If date is not set will add day before and day after to check if voucher valid today.
        $iTomorrow = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"));
        $iYesterday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));

        // Checks if beginning date is set, if not set $iFrom to yesterday so it will be valid.
        $iFrom = ((int) $oSeries->oxvoucherseries__oxbegindate->value) ?
            strtotime($oSeries->oxvoucherseries__oxbegindate->value) : $iYesterday;

        // Checks if end date is set, if no set $iTo to tomorrow so it will be valid.
        $iTo = ((int) $oSeries->oxvoucherseries__oxenddate->value) ?
            strtotime($oSeries->oxvoucherseries__oxenddate->value) : $iTomorrow;

        if ($iFrom < $iTime && $iTo > $iTime) {
            return true;
        }

        $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
        $oEx->setMessage('MESSAGE_COUPON_EXPIRED');
        if ($iFrom > $iTime && $iTo > $iTime) {
            $oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOVOUCHER');
        }
        $oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
        throw $oEx;
    }
protected function _isValidDate ( ) { $ oSeries = $ this -> getSerie ( ) ; $ iTime = time ( ) ; // If date is not set will add day before and day after to check if voucher valid today. $ iTomorrow = mktime ( 0 , 0 , 0 , date ( "m" ) , date ( "d" ) + 1 , date ( "Y" ) ) ; $ iYesterday = mktime ( 0 , 0 , 0 , date ( "m" ) , date ( "d" ) - 1 , date ( "Y" ) ) ; // Checks if beginning date is set, if not set $iFrom to yesterday so it will be valid. $ iFrom = ( ( int ) $ oSeries -> oxvoucherseries__oxbegindate -> value ) ? strtotime ( $ oSeries -> oxvoucherseries__oxbegindate -> value ) : $ iYesterday ; // Checks if end date is set, if no set $iTo to tomorrow so it will be valid. $ iTo = ( ( int ) $ oSeries -> oxvoucherseries__oxenddate -> value ) ? strtotime ( $ oSeries -> oxvoucherseries__oxenddate -> value ) : $ iTomorrow ; if ( $ iFrom < $ iTime && $ iTo > $ iTime ) { return true ; } $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ VoucherException :: class ) ; $ oEx -> setMessage ( 'MESSAGE_COUPON_EXPIRED' ) ; if ( $ iFrom > $ iTime && $ iTo > $ iTime ) { $ oEx -> setMessage ( 'ERROR_MESSAGE_VOUCHER_NOVOUCHER' ) ; } $ oEx -> setVoucherNr ( $ this -> oxvouchers__oxvouchernr -> value ) ; throw $ oEx ; }
Checks if voucher is in valid time period. Returns true on success.

@throws oxVoucherException exception

@return bool
Checks if voucher is in valid time period . Returns true on success .