Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kshitizmittal's avatar

Add One Day To date

$events[] = Calendar::event(
                    (@$activity->leavetypes->type_name ? @$activity->leavetypes->type_name : 'N/A'),
                    true,
                    new \DateTime($activity->start_date),
                    new \DateTime($activity->end_date),
                    true,
                    [
                        'color' => '#85e085',
                        'textColor' => '#008000',
                    ]
                );

I have to add 1 Day to end date because I need to counter a bug in fullcalendar which shows -1 day event length please help me.

0 likes
3 replies
manelgavalda's avatar

If you are using a carbon instance, you can use the function addDay():

$activity->end_date->addDay()
ChristophHarms's avatar
Level 18

Use Carbon instead of DateTime, it is included in Laravel.

use Illuminate\Support\Carbon;

// ...

$events[] = Calendar::event(
                    (@$activity->leavetypes->type_name ? @$activity->leavetypes->type_name : 'N/A'),
                    true,
                    Carbon::parse($activity->start_date),
                    Carbon::parse($activity->end_date)->addDay(),
                    true,
                    [
                        'color' => '#85e085',
                        'textColor' => '#008000',
                    ]
                );

Please or to participate in this conversation.