Changes for version v0.6.4 - 2026-04-23
- Maintenance
- SQLite database updated with the newly released IANA data version 2026b.
- New Features
- DateTime::Lite::TimeZone->new() now accepts an C<extended> boolean option. When set to a true value and the supplied name is not recognised as a valid IANA timezone name, new() calls resolve_abbreviation() with extended => 1 internally and, if a single unambiguous candidate is found, recurses with the resolved canonical name. This allows timezone abbreviations such as JST, CET, or EST to be passed directly to new() without requiring the caller to call resolve_abbreviation() explicitly. See synopsis for examples.
- DateTime::Lite->new() and set_time_zone() now accept a hash reference for the time_zone parameter. The hash reference is passed directly to DateTime::Lite::TimeZone->new(), allowing options such as extended => 1 or coordinate-based resolution to be specified inline.
- Bug Fixes
- DateTime::Lite->_new() now validates that a reference passed as time_zone is a blessed DateTime::Lite::TimeZone object, returning a clear error instead of silently misbehaving with an unexpected reference type.
- Fixed: offset_for_datetime() and offset_for_local_datetime() returned an incorrect offset for timezones that abolished DST after having used it, such as Asia/Tehran (DST abolished September 2022). The POSIX footer string (<+0330>-3:30 for Tehran) was applied unconditionally whenever a footer was present, overwriting historically correct bounded DST spans with the post-abolition rule. The footer is now only applied when the matched database span is open-ended (utc_end IS NULL / local_end IS NULL), which means that the timestamp is beyond all stored transitions. For timestamps within stored transitions, the database span is returned as-is. Also, both span lookup queries now use: ORDER BY (utc_start IS NULL) ASC, utc_start DESC (resp. local_start) to guarantee deterministic results when multiple spans satisfy the WHERE clause, because without ORDER BY, LIMIT 1 is non-deterministic across SQLite versions. The IS NULL expression is used instead of the NULLS LAST syntax, because it is only available from SQLite 3.30.0 (2019-10-04) onward and would fail on older installations. Reported by Andrew Grechkin (@andrew-grechkin), GitLab issue #2.
- Thread Safety
- DateTime::Lite::TimeZone: the package-level database handle cache ($DBH) and prepared statement cache ($STHS) are now keyed by thread ID (or PID when not running under threads). This prevents a DBD::SQLite error, such as "handle 2 is owned by thread aaaae23f22a0 not current thread" when multiple threads call timezone methods concurrently. The thread ID is obtained via threads->tid() when $Config{useithreads} is true, threads.pm is loaded, and threads->can('tid') is available; otherwise $$ is used.
Documentation
Compare DateTime and DateTime::Lite performance
Build the DateTime::Lite::TimeZone SQLite database
Generate leap_seconds.h for DateTime::Lite XS
Modules
Lightweight, low-dependency drop-in replacement for DateTime
Duration objects for use with DateTime::Lite
Exception object for DateTime::Lite
Infinite past and future DateTime::Lite objects
Pure-Perl fallback for the DateTime::Lite XS layer
Lightweight timezone support for DateTime::Lite
Provides
in lib/DateTime/Lite/Infinite.pm
in lib/DateTime/Lite/Infinite.pm
in lib/DateTime/Lite/Infinite.pm
in lib/DateTime/Lite.pm