Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def date_validator(value, schema_name=None):
msg = make_validation_error_msg(
value,
"JSON date value. Hint: use datetime.date.isoformat(), instead of datetime.date",
schema_name,
)
try:
pvalue = rfc3339.parse_date(value)
# pvalue = datetime.date.fromisoformat(value)
except Exception as e:
raise ValidationError(str(e) + msg)
if not isinstance(pvalue, datetime.date):
raise ValidationError(msg)