Have you seen our video tutorials? Check 'em out!

Cloning a form doesn't save the right dates.

edster - 1 month ago

I have enabled cloning of a stream entry and everything is working fine except I can't get my dates to work correctly.

When I clone, I dumped the date to make sure that it has the right timezone, which it does.

When I pass it to the form, it renders fine, however when I save it, it changes the date to UTC from what I entered in. I am also having issues saving new entries periodically and the dates being correct. Edit is saving the dates correctly.

Clone code below

public function copy(EventFormBuilder $form, EventRepository $events, $id)
    {
        $event = $events->find($id);

        $entry = clone($event);

        $entry->setAttribute('id', NULL);
        return $form->setEntry($entry)->render();

    }

ryanthompson - 1 month ago

The form input will always go through the value / mutation process based on the value input: https://github.com/anomalylabs/datetime-field_type/blob/master/src/DatetimeFieldTypeModifier.php#L50