News for hackers. Stuff that matters.
Re:Show HN: Nettu Scheduler – A self-hosted calendar and sch... by de6u99er on Monday March 29, 2021 @10:37AM (#26622298)
From my experience it is a common mistake to do overlap comparisons of intervals this way.

https://github.com/fmeringdal/nettu-scheduler/blob/df737e128...

IMO start time should be treated as inclusive, and end time as exclusive.

E.g. an event from 1pm-2pm does not overlap with an event starting at 2pm because it's end-time is defined as exclusive.

Therefore you need to replace one of you greater/lower-than's with a normal greater/lower comparison operator.

Re:Show HN: Nettu Scheduler – A self-hosted calendar and sch... by fmeringdal on Monday March 29, 2021 @03:14PM (#26626850)
Thanks for your feedback! I will look into it :)
Re:Show HN: Nettu Scheduler – A self-hosted calendar and sch... by de6u99er on Monday March 29, 2021 @06:29PM (#26629095)
No problem. Took me 2 min to find it. I actually searched for the term "overlap" to see if you're doing it correctly ;)

At least you're using one if statement. Many do interval overlap comparisons with two if statements.

Re:Show HN: Nettu Scheduler – A self-hosted calendar and sch... by fmeringdal on Monday March 29, 2021 @06:34PM (#26629144)
Haha! I must admit that I also did two if statements the first time I implemented overlaps ;)