Closed fty4 closed 2 years ago
To be 100% correct I would suggest to rename AddEvent()
to NewEvent()
(as used for NewCalendar()
).
Because it will not really add an event - it will create (and add) one instead.
But due compatibility it might be not the perfect choice to change..
LGTM
But due compatibility it might be not the perfect choice to change..
Definitely an issue. There is (given if / when) I have more time I would like to V2 this library with a lot of fixes.
Description Add function to add existing events to a calendar.
Background This will be required because I want to add the same event to multiple calendars. Currently I have to do it e.g. this way:
Another option also could be adding the already added event (
e := c1.AddEvent()
) to the second calendar (c2.Compotents = append(c2.Components, &e)
). In my opinion, both methods are not really elegant.New implementation Instead of using the unpleasant way by accessing Components directly it would be great to have another
AddEvent
function. Therefore I added the functionAddVEvent
(naming suggestions are welcome here) to be able to add a existing event instead of creating a new one withAddEvent
.(Also added some line breaks to separate functions)
Example The code works as follows:
output: