RFC3339 Validator

0.1.4 · active · verified Sat Mar 28

rfc3339-validator is a lightweight, pure Python library designed for strictly validating date-time strings against the RFC 3339 Internet Date/Time Format specification. Currently at version 0.1.4, its last release was in May 2021, indicating a mature, low-cadence project that provides a focused utility for ensuring RFC 3339 compliance in applications requiring precise time formatting, such as web APIs and data serialization.

Warnings

Install

Imports

Quickstart

The library provides a single, straightforward function, `validate_rfc3339`, which takes a string and returns `True` if it conforms to the RFC 3339 specification, and `False` otherwise. RFC 3339 strictly requires a timezone offset (e.g., '+09:00', '-05:00') or 'Z' for UTC.

from rfc3339_validator import validate_rfc3339

# Valid RFC3339 datetime
print(validate_rfc3339('2001-10-23T15:32:12.9023368Z'))
# Invalid RFC3339 datetime
print(validate_rfc3339('1424-45-93T15:32:12.9023368Z'))
# Another valid example with offset
print(validate_rfc3339('2023-09-24T15:30:00+09:00'))
# Invalid: missing timezone/offset, RFC3339 requires it
print(validate_rfc3339('2023-09-24T15:30:00'))

view raw JSON →