How do I correctly overload a date/datetime field?

Silverstripe Version: 4.5.0

Question:

I’m having trouble correctly overloading a date field. I would like to do the following:

  1. when the user has selected a product variation from a dropdown list and clicks save, the end date will be overridden by the start date plus duration of the selected product variation (in days)
  2. when no product variation is selected, the end date will be whatever the user has entered (I’m using display logic to show and hide fields according to user selection)

Not quite sure what I’m missing here… currently the DateTimeEnd field doesn’t get updated after its initial value has been set.

private static $db = [
        'DateTimeStart' => 'DBDatetime',
        'DateTimeEnd' => 'DBDatetime',
        'IsAllDay' => 'Boolean'
];

private static $has_one = [
		'ProductVariation' => ProductVariation::class
];

public function setDateTimeEnd() {
        $variation = $this->ProductVariation();
        if ($variation->ID != null) {
            return date('Y-m-d H:i:s',strtotime($this->obj("DateTimeStart")->getValue() . ' + ' . $variation->Duration . ' days'));
        }
}

Hoping someone can help.