diff --git a/pyproject.toml b/pyproject.toml index bf20797..8b88833 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [project] name = "uuid7-standard" -version = "1.0.0" +version = "1.1.0" description = "UUIDv7 with the final standard. Not to be confused with the uuid7 package on pypi, based on a draft version that was very different." readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.8" dependencies = [] authors = [ {name = "Leo Vasanko"}, diff --git a/uuid7.py b/uuid7.py index 149682d..531b599 100644 --- a/uuid7.py +++ b/uuid7.py @@ -1,3 +1,4 @@ +from __future__ import annotations from datetime import datetime from datetime import timezone as _tz from secrets import token_bytes as _token_bytes @@ -28,7 +29,7 @@ def time(u: UUID | str) -> datetime: """ if not isinstance(u, UUID): u = UUID(u) - if u.version != 7: + if u.version != 7 or u.variant != "specified in RFC 4122": raise ValueError("Not a UUIDv7") ts = int.from_bytes(u.bytes[:6], "big") return datetime.fromtimestamp(ts / 1000, tz=_tz.utc)