Skip to content

Repository files navigation

agecheck

PyPI Python Versions CI License: MIT

Date-of-birth / age-threshold utility with timezone-correct date math. Answer whether someone meets a jurisdiction minimum age using the calendar date in that jurisdiction's timezone.

Install

pip install agecheck

Quickstart

from datetime import date
from agecheck import is_of_age, age_on

dob = date(2000, 6, 15)
assert is_of_age(dob, 18, on=date(2018, 6, 15), tz="UTC") is True
assert is_of_age(dob, 18, on=date(2018, 6, 14), tz="UTC") is False
assert age_on(dob, on=date(2026, 6, 15), tz="UTC") == 26

Why this exists

  • Birthday boundaries must respect jurisdiction local date, not server UTC alone
  • UTC works with the stdlib; IANA zones optional via tzdata
  • Simple is_of_age / age_on API for compliance checks

API

Symbol Description
is_of_age(dob, minimum, *, on, tz) True if age meets minimum
age_on(dob, on=None, *, tz) Whole years of age on a date

Related packages

Part of the coldbricks micro-library suite (small, typed, zero-dependency helpers):

Package Role
buzzkill Guaranteed shutdown callbacks
aftercare Reverse-order teardown
fluffer Startup pre-warm
edging Token-bucket rate limit
readback Echo-confirmation validation
hearback Output re-validation decorator
agecheck Timezone-correct age thresholds
transponder State broadcast on change

Development

pip install -e ".[dev]"
pytest -q
ruff check .
mypy src

Roadmap

This is an early 0.1.0 release (Alpha) with active development planned:

  • Jurisdiction preset table (US states, EU defaults)
  • Optional document-level verification helpers
  • Stricter input parsing modes

License

MIT © Coldbricks — coldbricks@gmail.com

About

Date-of-birth / age-threshold utility with timezone-correct date math.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages