@ -133,8 +133,13 @@ def get_int_list(data, id_type):
return int_values
return int_values
def validate_date ( date_text , method , return_as = None ) :
def validate_date ( date_text , method , return_as = None ) :
try : date_obg = datetime . strptime ( str ( date_text ) , " % Y- % m- %d " if " - " in str ( date_text ) else " % m/ %d / % Y " )
if isinstance ( date_text , datetime ) :
except ValueError : raise Failed ( f " Collection Error: { method } : { date_text } must match pattern YYYY-MM-DD (e.g. 2020-12-25) or MM/DD/YYYY (e.g. 12/25/2020) " )
date_obg = date_text
else :
try :
date_obg = datetime . strptime ( str ( date_text ) , " % Y- % m- %d " if " - " in str ( date_text ) else " % m/ %d / % Y " )
except ValueError :
raise Failed ( f " Collection Error: { method } : { date_text } must match pattern YYYY-MM-DD (e.g. 2020-12-25) or MM/DD/YYYY (e.g. 12/25/2020) " )
return datetime . strftime ( date_obg , return_as ) if return_as else date_obg
return datetime . strftime ( date_obg , return_as ) if return_as else date_obg
def logger_input ( prompt , timeout = 60 ) :
def logger_input ( prompt , timeout = 60 ) :