Could you check the example (https://github.com/dpi/oh_blocks) for D8 & D9?

D8: Recurring Dates Field 8.x-2.2; oh 2.0.0-alpha5
D9: Recurring Dates Field 3.0.0-beta1; oh 2.0.0-alpha5

I get an error on both of them

D8:
TypeError: Argument 1 passed to Drupal\oh\OhDateRange::__construct() must implement interface DateTimeInterface, instance of Drupal\Core\Datetime\DrupalDateTime given, called in /var/www/vhosts/test.xyz.de/modules/av_oh_block/src/Plugin/Block/OhBlocksSampleA.php on line 107 in Drupal\oh\OhDateRange->__construct() (line 37 of modules/oh/src/OhDateRange.php).

D9:
Drupal\Component\Plugin\Exception\ContextException: The entity context is not a valid context. in Drupal\Component\Plugin\ContextAwarePluginBase->getContextDefinition() (line 92 of core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php).

Thanks

Comments

HeavyStoneHead created an issue. See original summary.

dpi’s picture

Version: 2.0.0-alpha5 » 8.x-1.x-dev
Status: Active » Closed (won't fix)

Hey, I dont intend to maintain that project, make sure you dont rely on it! Copy the code as you like.

must implement interface DateTimeInterface, instance of Drupal\Core\Datetime\DrupalDateTime given

DDT no longer used, use PHP's DT, per #3135388: Swap DDT to PHP DT. Changed this to 1.x per that ticket.

-

Issue is also for a different project, so closing.

heavystonehead’s picture

thanks for the link

here my changes (D8 tested):

I remove:
use Drupal\Core\Datetime\DrupalDateTime;

and change this
$start = new DrupalDateTime('today 0:00');
to
$start = new \DateTime('today 0:00');