How to use the rfc3339.parse_date function in rfc3339

To help you get started, we’ve selected a few rfc3339 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github omarryhan / aiogoogle / aiogoogle / validate.py View on Github external
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)

rfc3339

Format dates according to the RFC 3339.

ISC
Latest version published 5 years ago

Package Health Score

49 / 100
Full package analysis