Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiday are events not spanning all days #31

Open
nathanmay opened this issue May 24, 2024 · 8 comments
Open

Multiday are events not spanning all days #31

nathanmay opened this issue May 24, 2024 · 8 comments

Comments

@nathanmay
Copy link

nathanmay commented May 24, 2024

Using your demo code for conveneince, when setting a start date and end date, the event only shows on the start date and doesnt span across all days.

I have tried with both the multiday tag and without.

This was previously working but I have recently upgraded to Livewire 3 and laravel 11 - So guessing it is somewhat related.

I am runing php 8.2.

public function events() : Collection
{
    return collect([
        [
            'id' => 1,
            'title' => 'Breakfast',
            'description' => 'Pancakes! 🥞',
            'date' => Carbon::today(),
            'end' => Carbon::tomorrow(),
        ],
    ]);
}

OR...

public function events() : Collection
{
    return collect([
        [
            'id' => 1,
            'title' => 'Breakfast',
            'description' => 'Pancakes! 🥞',
            'date' => Carbon::today(),
            'end' => Carbon::tomorrow(),
            'multiday' => true
        ],
    ]);
}
Screenshot 2024-05-24 182613
@lrljoe
Copy link

lrljoe commented Aug 31, 2024

Yeah, there are definitely bugs with this, there are ways to get this working, but given the number of issues, and staleness, I doubt it'll get resolved.

I've just applied fixes locally on a private fork.

@joshtorres
Copy link
Member

joshtorres commented Sep 3, 2024

Thank you for pointing this out and trying to find a resolution. I unfortunately don't have time to work on this currently. @lrljoe you said you found a solution? Do you want to create a PR? I'll look into merging it. Thanks for your help with this. I do want to still support this calendar, I just have a backlog of work currently.

@lrljoe
Copy link

lrljoe commented Oct 18, 2024

@joshtorres - I do have a solution for this, just need to look at how best to document the behaviour!

@joshtorres
Copy link
Member

@lrljoe ok awesome. If you want to create a PR when you're ready, I'll look it over.

@lrljoe
Copy link

lrljoe commented Oct 27, 2024

@joshtorres - I'm in two minds about whether it should be a PR, or just some simple documentation to be honest!

At the moment, my (pretty simple) modification allows for:

  • Multi Day spanning events
    E.g.
    Event starts on Monday at 09:00
    Runs 24/7 Until:
    Event finishes on Wednesday at 17:00

  • Multi Day repeated events
    E.g.
    Event runs for 3 consecutive days, 09:00 - 17:00 each day

To do this smoothly I introduced these properties into the Events collection:

  • start_date
  • end_date
  • start_time
  • end_time
  • repeats (used if it's an event that repeats, rather than spans)

The only real change is over-riding getEventsForDay()

I've had to reduce the font-size to fit it clearly into a screenshot, but this demonstrates the behaviour:

image

Which was generated by:

    public function events() : Collection
    {
        return collect([
            [
                'id' => 1,
                'title' => 'Breakfast',
                'start_date' => Carbon::today()->addDays(5),
                'end_date' => Carbon::today()->addDays(5),
                'start_time' => '09:00',
                'end_time' => '10:00',
            ],
            [
                'id' => 2,
                'title' => 'Meeting with Pamela',
                'start_date' => Carbon::tomorrow()->addDays(6),
                'end_date' => Carbon::tomorrow()->addDays(6),
                'start_time' => '14:00',
                'end_time' => '16:00',
            ],
            [
                'id' => 3,
                'title' => 'Two Dayer Repeat',
                'start_date' => Carbon::today()->addDays(10),
                'end_date' => Carbon::tomorrow()->addDays(10),
                'start_time' => '10:00',
                'end_time' => '19:00',
                'repeats' => true,
            ],
            [
                'id' => 4,
                'title' => ' Spans Five Days',
                'start_date' => Carbon::today()->addDays(9),
                'end_date' => Carbon::today()->addDays(14),
                'start_time' => '12:00',
                'end_time' => '19:00',
            ],
            [
                'id' => 5,
                'title' => 'Wednesday Breakfast',
                'start_date' => Carbon::today()->addDays(10),
                'end_date' => Carbon::today()->addDays(10),
                'start_time' => '08:00',
                'end_time' => '09:00',
            ]
        ]);
    }

At the moment I set a "multiday" property on the "event", which prevents the draggable behaviour, as I haven't had a proper chance to sort out linking the elements so that they drag together.

@lrljoe
Copy link

lrljoe commented Nov 4, 2024

@joshtorres - what do you think out of the following:

Option 1

  • Docs to explain how to extend the default behaviour, to enable:
    • Multi-Day Spanning
    • Repeat Events

OR

Option 2

  • Adding in a secondary Component that extends the base "LivewireCalendar" (e.g. LivewireCalendarExtended) and provides the approaches for:
    • Multi-Day Spanning
    • Repeat Events

Along with the relevant docs

OR

Option 3

  • Adding in backwards-compatible code that enables the new functionality, while not breaking anything existing, which would be a longer term approach, as people will have all kinds of deviations from the norm

Which option would you like a PR for

@joshtorres
Copy link
Member

I'm thinking just having Docs might be the best option, depending on how complicated it is. Since everyone won't need that functionality, it's probably not worth our time to reinvent it. If you want to do Option 2 so they have an example, that would be really nice and helpful, but having docs would already make it way better. Thanks!

@lrljoe
Copy link

lrljoe commented Dec 1, 2024

Self prompt so it doesn't slip off my radar, I'll look to write the docs this side of xmas covering how to implement

MultiDay Spanning event
(i.e. starts Monday at 1pm, finishes Wednesday at 2pm)

and

MultiDay Repeating event
(i.e. happens every day between 1pm and 2pm for x days)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants