Add the `zoneinfo` module
Adds the zoneinfo module and integrates ZoneInfo into datetime.
ZoneInfo(key) resolves an IANA key against the tz database the worker already carries (jiff's bundled tzdb, the same source OsPolicy::timezone uses), with CPython's key validation and ZoneInfoNotFoundError message.
available_timezones() returns the set of keys; ZoneInfo.no_cache() and ZoneInfo.clear_cache() exist for compatibility.
utcoffset(dt), tzname(dt), dst(dt) and fromutc(dt) follow CPython; a wall clock in a DST gap takes the pre-transition offset, as CPython's fold=0 does.
In datetime, a ZoneInfo works as tzinfo for construction, replace, combine, now(tz), astimezone, utcoffset/tzname/dst, timetz() and timedelta arithmetic.
The offset and abbreviation in force at each wall clock are resolved on demand and the zone object stays as dt.tzinfo.
Two datetimes sharing a tzinfo object subtract and compare by wall clock, as in CPython.
monty-types gains SandboxTimeZone::dst_seconds, available_names and info_for_local to back this.
Divergences recorded in limitations/zoneinfo.md and limitations/datetime.md:
ZoneInfoNotFoundErroris bound toKeyError- no instance cache:
ZoneInfo('UTC') is ZoneInfo('UTC')isFalse(==is by key) ZoneInfo.from_file()is not implemented;reset_tzpath/TZPATHare absentdatetime.now(ZoneInfo(...))under theCallHostclock policy raisesNotImplementedErrortime(tzinfo=ZoneInfo(...))raisesTypeError, since a time has no date to resolve the zonefoldis not read, so ambiguous wall clocks resolve to the first occurrence- keys are case-sensitive
dst()is approximated as the difference from the zone's standard offset that year
Module registered in limitations/modules.md, docs/limitations/index.md, SANDBOX_MODULE_NAMES, the JS external-module list and binary_serde.rs; the Type fingerprint and builtin_type_serialization.txt fixture are extended.
Tests in zoneinfo__module.py (skip-cpython-windows, which has no time.tzset) plus additions to the datetime cases.
Part of the set of PRs for the stdlib gaps reported by a user running Monty as an agent code-mode sandbox.
š¤ Generated with Claude Code
https://claude.ai/code/session_018zfZ5wd33kjDtV7BoUUV2T
Summary by cubic
Adds the zoneinfo module with ZoneInfo and available_timezones(), and integrates ZoneInfo as a tzinfo for datetime. Offsets and abbreviations are resolved on demand from the worker's bundled tz database, and datetimes sharing a ZoneInfo object subtract and compare by wall clock, as in CPython.
Notable divergences:
ZoneInfoNotFoundErrorisKeyError; there is no instance cache,from_file(),TZPATH, orreset_tzpath(), andclear_cache()is a no-op.foldis ignored, ambiguous wall clocks take the first occurrence, anddst()is approximated from the year's standard offset.datetime.now(ZoneInfo(...))raisesNotImplementedErrorunder thecall_hostclock policy.time(tzinfo=ZoneInfo(...))raisesTypeError, since a bare time has no date to resolve the zone.- A
ZoneInfocannot cross the host boundary; an awaredatetimeis serialized with the fixed offset and abbreviation in force at that instant.