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

Time complexity problem #24

Open
ilhamfu opened this issue Nov 29, 2021 · 0 comments
Open

Time complexity problem #24

ilhamfu opened this issue Nov 29, 2021 · 0 comments

Comments

@ilhamfu
Copy link

ilhamfu commented Nov 29, 2021

hey, thank you for making this kind of package for livewire, I always made my own livewire calendar but really doesn't know how to make it reusable

I read some of your code and found the get event from day function is a bit clunky IMO

public function getEventsForDay($day, Collection $events): Collection
    {
        return $events
            ->filter(function ($event) use ($day) {
                return Carbon::parse($event['date'])->isSameDay($day);
            });
    }

I'm afraid this will do tons of repeated loops and might cause a problem if a certain month has tons of events. my suggestion is instead of doing it maybe you can encourage users to group the event by timestamp and create a hashmap, instead of getting it per day

Also maybe you can use carbon period CarbonPeriod::create to create a list of date

P.S. more like 35>42 repeated loop

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

1 participant