Added len to Span class, and added an is_valid method to date. is_valid similar to is_regular, but allows partial dates

svn: r11528
This commit is contained in:
Doug Blank 2008-12-27 21:31:16 +00:00
parent e9bf31ef33
commit 323ac9257f

View File

@ -111,6 +111,9 @@ class Span:
return False
return self.diff_tuple > other.diff_tuple
def __len__(self):
return len(self.diff_tuple)
#-------------------------------------------------------------------------
#
@ -904,6 +907,12 @@ class Date:
"""
return self.modifier != Date.MOD_TEXTONLY
def is_valid(self):
"""
Return true if any part of the date is valid.
"""
return self.modifier != Date.MOD_TEXTONLY and self.sortval != 0
def get_stop_year(self):
"""
Return the day of the year associated with the second part of a