Code snippet to check for overlaps between date ranges