Tasks in Calendar default to 2 hours and start on Due date

Tasks show in Calendar from the Due Time for 2 hours.

Shouldn’t the task period be displayed in the calendar between the task Start Date and task due date?

I am noticing the same. Would like to see it be the range of time from start to due date. Any clarification on this?

Currently using 7.9.6 and have the same issue.

E.g. the start date is 24 Oct 10:00 and end date is 25 Oct 11:00. In the calendar, the task is highlighted from 25 Oct 11:00 to 13:00

Is this a bug?

We are having the same problem. Has anyone found a fix?

It’s better to search for the Issue on Github and open one, if it doesn’t already exist.


If you can please try it first on the live demo, that helps make sure it’s not a problem just with your installation.


Thanks for reporting

Using 7.10.4 and the issue is still there.

Have submitted a ticket at

1 Like

We’re on 7.11.2 and experiencing this issue. Anyone on a newer installation can confirm this bug has been squashed?

Works fine on my 7.11.6.

Maybe we can close that issue?

I’d prefer not to close this. I have 3 active installations ranging from 11.2 to 11.6 and here’s a screen shot from 11.6

The task is set for Friday July 19 from 4-5 (one hour).
What’s rendered on calendar for all tasks like this one is it’s backtimed to start at the end time (5PM) and renders as 2 hours regardless of the duration.

https://ibb.co/0QtFsxk <- image upload doesn’t seem to be working

I am able to reproduce this error on the live demo site.

https://ibb.co/D5TmK3X <-image link uploads to forum are not working ATM

I don’t know how to solve this, I guess we’ll have to wait until that issue gets some attention… :frowning:

After deep investigation, i found that, the task module dont have duration hrs and mins field, so i calculated the duration hrs and mins.


     * CalendarActivity constructor.
     * @param $args
    public function __construct($args)        {
        // if we've passed in an array, then this is a free/busy slot
        // and does not have a sugarbean associated to it
        global $timedate;

        if (is_array($args)) {
            $this->start_time = clone $args[0];
            $this->end_time = clone $args[1];
            $this->sugar_bean = null;


        // else do regular constructor..

        $sugar_bean = $args;
        $this->sugar_bean = $sugar_bean;

        if ($sugar_bean->object_name === 'Task') {
            if (!empty($this->sugar_bean->date_start)) {
                $this->start_time = $timedate->fromUser($this->sugar_bean->date_start);
            } else {
                $this->start_time = $timedate->fromUser($this->sugar_bean->date_due);
            if (empty($this->start_time)) {
            $this->end_time = $timedate->fromUser($this->sugar_bean->date_due);
            //VJ - Script to fix task module duration issue - starts
            $start_time = strtotime($this->start_time);  
            $end_time = strtotime($this->end_time);
            $hours = floor(($end_time - $start_time) / (60*60));
            $mins = floor((($end_time - $start_time) - ($hours * (60*60))) / (60));
            $this->sugar_bean->duration_hours = $hours;
            $this->sugar_bean->duration_minutes = $mins;
            //VJ - Script to fix task module duration issue - ends

        } else {
            $this->start_time = $timedate->fromUser($this->sugar_bean->date_start);
            if (empty($this->start_time)) {
            $hours = $this->sugar_bean->duration_hours;
            if (empty($hours)) {
                $hours = 0;
            $mins = $this->sugar_bean->duration_minutes;
            if (empty($mins)) {
                $mins = 0;
            $this->end_time = $this->start_time->get("+$hours hours $mins minutes");
        // Convert it back to database time so we can properly manage it for getting the proper start and end dates

Hope, it will resolve the issue.


@Vijay_S thanks for that (and welcome to the Community! :tada:)

Do you want to try creating a PR on GitHub with the fix?

Just go to that file on the hotfix-7.10-x branch and click the :pencil2: icon to edit it:

When you save it, GitHub will create a fork of SuiteCRM in your user area, and create a new branch for your fix. Then it offers for you to create a PR into our main repo.

I’ll help you if you run into any problems. Thanks!