* src/DateParser.py: Handle month=12 in gregorian_valid
svn: r3718
This commit is contained in:
parent
270148fd20
commit
d412332597
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user