How to edit a date field in a plugin
The problem you have here is you are calling saveElement from EVENT_AFTER_SAVE_ELEMENT which is causing an infinite loop.

You need to set:

$entry-&gt;propagating = true;


Before calling the saveElement method.

Dates should be a PHP DateTime class, e.g:

$entry-&gt;rangeStart = new \DateTime('2019-04-10 19:00:00');