Fullcalendar event resizing and smart_date field duration

Created on 31 January 2024, about 1 year ago
Updated 1 February 2024, about 1 year ago

Hello,

We are using smart_date and fullcalendar_views to encode and edit events on a calendar view.
When resizing the events, the smart date field value and end_value are updated properly but the duration is not updated.

Reading through the fullcalendarcontroller.php file on the line 163 there is this code:

      $entity->{$start_field}[$delta]->value = strtotime($start_date);
      $duration = $entity->{$start_field}[$delta]->duration;
      $this->calculateEndDateFromDuration($duration, $end_date, $start_date);
      $entity->{$end_field}[$delta]->end_value = $end_date;
      if ($duration != $entity->{$start_field}[$delta]->duration) {
        $entity->{$start_field}[$delta]->duration = $duration;
      }
      $entity->save();

Code is executed when resizing the event I can see logs when I put some there. But I don't understand why this code set a $duration variable with the actual duration and check if it is any different than what it was set just the line before?
Am I missing something? I have tried to set the duration with a difference between end_date and start_date but I think it can't be done like that since it should probably be set to "custom duration" which is not a number of seconds nor milliseconds....

Any help would be much appreciated :) Thanks you

💬 Support request
Status

Active

Version

4.1

Component

Code

Created by

🇧🇪Belgium davidiio

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @davidiio
  • 🇧🇪Belgium davidiio

    Hello again,

    Duration seems to be properly updated when using code like this:

    $entity->{$start_field}[$delta]->duration = ($entity->{$end_field}[$delta]->end_value - $entity->{$start_field}[$delta]->value) / 60;

    But I would really appreciate if someone with mre knowledge about smart_date could check if this is a bug or not and if my approach is correct.

    Thanks :)

Production build 0.71.5 2024