DateRange

A date range is a period in time. By default, a date range begins with negative infinity and ends with infinity.

Methods

__cmp__(self, other)

   def __cmp__(self, other):

Compares the start date of two date ranges. If the two date ranges have the same start date, compares the end date.

__init__(self, startDate, endDate)

   def __init__(self, 
                startDate = Date(foreverPast = 1), 
                endDate = Date(foreverFuture = 1)):

Constructs a date range. By default, the start date is the bottomless past and the end date is the endless future. This allows us to define date ranges from a given point to the end of time, or from the beginning of time to a given point.

__str__(self)

   def __str__(self):

Formats the receiver as a string (two new standard format dates seperated by a dash.

alignedWith(self, other)

   def alignedWith(self, other):

Returns true if the records are "aligned" - that is, if the start date of one matches the end date of the other.

getEnd(self)

   def getEnd(self):

Returns the end date.

getStart(self)

   def getStart(self):

Returns the start date.

includes(self, date)

   def includes(self, date):

Returns true if the date range includes the given date. In keeping with the spirit of date ranges, inclusion is defined as being greater than or equal to the start date but less than the end date.

overlap(self, other)

   def overlap(self, other):

Returns true if the receiver date range overlaps with the other date range.

setEnd(self, end)

   def setEnd(self, end):

Resets the end Date.

setStart(self, start)

   def setStart(self, start):

Resets the start Date.

union(self, other)

   def union(self, other):

Returns a date range that is the union of the periods defined by self and other, or None if the two periods do not overlap.