* src/DateParser.py: Handle month=12 in gregorian_valid

svn: r3718
This commit is contained in:
Don Allingham 2004-11-10 04:20:47 +00:00
parent 270148fd20
commit d412332597
2 changed files with 11 additions and 5 deletions

View File

@ -1,3 +1,6 @@
2004-11-09 Don Allingham <dallingham@users.sourceforge.net>
* src/DateParser.py: Handle month=12 in gregorian_valid
2004-11-09 Alex Roitman <shura@alex.neuro.umn.edu>
* src/WriteGedcom.py: Remove extraneous import.

View File

@ -49,18 +49,21 @@ import Date
# Top-level module functions
#
#-------------------------------------------------------------------------
_max_days = [ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]
def gregorian_valid(date_tuple):
day = date_tuple[0]
month = date_tuple[1]
valid = True
if month > 12:
valid = False
elif day > _max_days[month]:
try:
if month > 12:
valid = False
elif day > _max_days[month-1]:
valid = False
except:
valid = False
return valid
_max_days = [ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]
#-------------------------------------------------------------------------
#
# Parser class