GuavaCZ / calendar

MIT License
140 stars 13 forks source link

[Request]: current date #43

Closed mwagena closed 1 month ago

mwagena commented 1 month ago

What feature would you like to add?

Is there a way to get the current date from the Calendar instance? with for example a getDate() accessor? Thanks in advance

Notes

No response

lukas-frey commented 1 month ago

Hi, you can try using the onViewMount event and read the dates from the current view:

protected bool $viewDidMountEnabled = true;

public function onViewDidMount(array $info = []): void {
    // Read the view object from the $info array here
}
mwagena commented 1 month ago

Hi,

Thanks for the reply, I have tried that method but it doesn't update on prev / next events.

lukas-frey commented 1 month ago

Then you can try this:

https://github.com/GuavaCZ/calendar/issues/42#issuecomment-2422542797

lukas-frey commented 1 month ago

And another possibility is this:


protected bool $eventAllUpdatedEnabled = true;

    public function onEventAllUpdated(array $info = []): void {}
mwagena commented 1 month ago

hi, I ended up using onEventAllUpdated storing the info in a session to use it later in a 'duplicate day/week' action. Thanks