Date Overlap testing - Golf?

2002-10-16 Thread Rafiq Ismail (ADMIN)
This is an easy one, but there has to be some standard for doing it; which is what I'm curious about. I want a simple routine which tests date_a against date_b to see if date_a intersects in anyway with date_b. The dates are initially supplied as (,mm?,dd?) and turned into days since epoch u

Re: Date Overlap testing - Golf?

2002-10-16 Thread Shevek
On Wed, 16 Oct 2002, Rafiq Ismail (ADMIN) wrote: > I want a simple routine which tests date_a against date_b to see if date_a > intersects in anyway with date_b. The dates are initially supplied as This question is underspecified. Two points cannot intersect unless they are coincident points.

Re: Date Overlap testing - Golf?

2002-10-16 Thread Rafiq Ismail (ADMIN)
On Wed, 16 Oct 2002, Shevek wrote: > On Wed, 16 Oct 2002, Rafiq Ismail (ADMIN) wrote: > This question is underspecified. Two points cannot intersect unless they > are coincident points. Define the endpoints of your ranges. I'm assuming > that date_a and date_b are just point dates. Indeed, howe

Re: Date Overlap testing - Golf?

2002-10-16 Thread Roger Burton West
On Wed, Oct 16, 2002 at 12:17:14PM +, Rafiq Ismail (ADMIN) wrote: >1) We actually have $intervalStart and $intervalEnd, marking a period in >time, where $intervalEnd >= $intervalStart. > >2) We also have: > $startTest and $startEnd. And you're asking "does any part of Test lie within I

Re: Date Overlap testing - Golf?

2002-10-16 Thread Rafiq Ismail (ADMIN)
On Wed, 16 Oct 2002, Roger Burton West wrote: > And you're asking "does any part of Test lie within Interval"? > > 0 if test.start > interval.end > 0 if test.end < interval.start > 1 otherwise Nah, return true if the two intervals overlap, at all. It's just messy looking and I wondered if there

Re: Date Overlap testing - Golf?

2002-10-16 Thread Simon Wilcox
On Wed, 16 Oct 2002, Rafiq Ismail (ADMIN) wrote: > > On Wed, 16 Oct 2002, Roger Burton West wrote: > > And you're asking "does any part of Test lie within Interval"? > > > > 0 if test.start > interval.end > > 0 if test.end < interval.start > > 1 otherwise > Nah, return true if the two intervals

Re: Date Overlap testing - Golf?

2002-10-16 Thread Rafiq Ismail (ADMIN)
On Wed, 16 Oct 2002, Simon Wilcox wrote: > What Roger said. > > return 1 unless ( $startTest > $intervalEnd || $endTest < $intervalStart ); I just had one of those "duh," moments. Thank u.