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

Introduce a function for date range events #5

Closed
wants to merge 1 commit into from
Closed

Introduce a function for date range events #5

wants to merge 1 commit into from

Conversation

pantierra
Copy link
Contributor

No description provided.

@pantierra pantierra changed the title Introduces a function for date range events. Introduce a function for date range events Jan 17, 2024
for d := start; !d.After(end); d = d.AddDate(0, 0, 1) {
dailyEvents, err := cal.GetEventsOnDay(d)
if err != nil {
return nil, err
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather just skip the day then if there is an error for a specific day. I'd just continue if there is an error and maybe log it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted.

@@ -42,7 +42,21 @@ func (cal *Calendar) SetTimezone(tz *time.Location) {
cal.tz = tz
}

func (cal Calendar) GetEventsOn(date time.Time) ([]ical.Event, error) {
func (cal Calendar) GetEventsOfRange(start time.Time, end time.Time) ([]ical.Event, error) {
var allEvents []ical.Event
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider initializing this variable for the reasons I mentioned in #6.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is no nil return anymore.

Copy link
Owner

@gueldenstone gueldenstone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to have some tests even if they are based on the exisiting small set of test data.

@pantierra pantierra closed this by deleting the head repository Mar 19, 2024
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

Successfully merging this pull request may close these issues.

2 participants