DateTime-Lite

 view release on metacpan or  search on metacpan

CHANGES  view on Meta::CPAN

      documented.
    - Fixed _get_zone_info() which ignored its $name parameter and used object-based
      properties even when called as a class function, which would have triggered a
      perl error.
    - Modified fatal() to use the global variable $FATAL_EXCEPTIONS when called as a 
      class function, or the 'fatal' instance property.
    - Fixed names_in_country(): the prepared statement cache key was incorrectly shared
      with names_in_category() (both using 'names_in_category'), so whichever method was
      called second would retrieve the other method's prepared statement and produce
      silently wrong results.
      The cache key is now 'names_in_country'. The method now also correctly passes the
      $code argument to execute() (it was  previously called with no arguments).
    - Fixed names_in_category() which called execute() without passing the $cat argument,
      so the SQL placeholder bound to NULL and the method returned zero matches for every
      input. Now passes $cat to execute().
    - Fixed categories() query which returned an empty-string entry from the Factory zone
      (which has a NULL category in IANA data). Query now filters with 'WHERE category
      IS NOT NULL'.
    - Fixed bad variable name $row used in aliases(), all_names(),
      categories(), countries(), names_in_category(), and names_in_country().

    [Defensive Guards]
    - Added instance guards to eight class-callable methods that require a blessed
      instance: category(), country_codes(), has_dst_changes(), is_dst_for_datetime(),
      offset_for_datetime(), offset_for_local_datetime(), short_name_for_datetime(),
      and tzif_version(). These return a clean error via $self->error() rather than
      dereferencing a class name string under strict refs.
    - Added die() guards in _set_get_prop() and _lookup_span() to catch internal design
      errors where a class name is passed instead of an instance. These are private
      methods, so a die() (rather than a clean return) is appropriate: reaching them in
      class context indicates a caller bug that should surface immediately.

    [API Additions]
    - Introduced new package variable $FATAL_EXCEPTIONS for DateTime::Lite::TimeZone,
      similar to the one used in DateTime::Lite.
      When set to a true value, newly constructed DateTime::Lite::TimeZone objects
      default to fatal set to true. Per-object fatal flags remain individually settable
      via the fatal() accessor/mutator.

v0.6.1 2026-04-19T08:22:20+0900
    - Fixed _dbh_add_user_defined_functions() in DateTime::Lite::TimeZone to
      correctly handle SQLite installations where pragma_function_list is
      unavailable.
      The previous implementation queried pragma_function_list unconditionally to
      detect whether SQLite's built-in math functions (sqrt, sin, cos, asin) were
      compiled in (with the macro 'SQLITE_ENABLE_MATH_FUNCTIONS'). That table-valued
      pragma is only available since SQLite 3.16.0 (2017-01-02).
      So, older installations raised the error: "no such table: pragma_function_list"
      causing t/14.tz_coordinates.t to fail entirely.
      The detection logic is now version-aware, based on $DBD::SQLite::sqlite_version:
        - SQLite >= 3.35.0 (2021-03-12): pragma_function_list is queried for 'sqrt'.
          The check runs before any UDF is registered, so a hit is guaranteed to be a
          native function. A miss means the build omitted -DSQLITE_ENABLE_MATH_FUNCTIONS;
          Perl UDFs are registered as fallback.
        - SQLite >= 3.16.0 and < 3.35.0: pragma_function_list exists but the math
          functions cannot be present regardless of the build flags;
          Perl UDFs are registered unconditionally without querying the pragma.
        - SQLite < 3.16.0: pragma_function_list is not available as a table-valued
          function, so Perl UDFs are registered unconditionally.
      UDFs via sqlite_create_function() are available on all SQLite >= 3.0.0, so
      coordinate-based timezone resolution now works transparently on all supported
      SQLite versions.
      Reported via CPAN Testers on Perl 5.20.0, 5.22.2 and 5.24.0 on x86_64-linux
      (Debian Wheezy, system SQLite < 3.16.0).
      Thanks to Slaven Rezić for the detailed test reports.
    - Added .gitlab-ci.yml. The pipeline covers Perl 5.10.1 through 5.40 on Linux,
      plus a dedicated job that builds SQLite 3.15.2 from the official autoconf tarball
      (the last release before 3.16.0) to ensure the unconditional UDF registration path
      is exercised in CI.

v0.6.0 2026-04-17T22:30:20+0900
    - Added extended_aliases table to tz.sqlite3 (schema v0.6.0).
      abbreviations not stored as TZif type entries in the IANA database, such as BDT,
      CEST, HAEC, JST, and the full set of NATO military single-letter zones.
      Each abbreviation maps to one or more canonical IANA zone names.
      One row per (abbreviation, zone_id) pair with 'is_primary' marking the most
      commonly accepted canonical zone when multiple candidates exist.
      Two triggers enforce that at most one is_primary = 1 row exists per abbreviation
      (on INSERT and on UPDATE OF is_primary).
      355 timezone abbreviations, 535 (abbreviation, zone) pairs, covering real-world
    - Updated tz.sqlite3 with new schema and latest data (tzdata 2026a).
    - Extended resolve_abbreviation() in DateTime::Lite::TimeZone with an optional
      'extended' boolean argument.
      When true and the abbreviation is absent from the IANA types table, the method
      falls back to querying the new table 'extended_aliases'.
      Extended results carry utc_offset => undef and is_dst => undef (the extended
      alias table maps names only); the new 'is_primary' and 'extended' keys are added
      to each result hashref.
      The ambiguity flag for extended results is based on candidate count and
      'is_primary': 'ambiguous' is set to 0 when exactly one 'is_primary' exists,
      otherwise, 'ambiguous' is set to 1.
      Existing callers are unaffected: without the option 'extended' set to a true value,
      the behaviour is identical to the previous version v0.5.0.
    - Added the property 'extended' set to 0 in all IANA results returned from
      resolve_abbreviation() for consistency with extended alias results.
    - Added cached prepared statement resolve_abbreviation_extended for the
      'extended_aliases' table query, consistent with existing statement caching.
    - Updated POD for resolve_abbreviation() to document the boolean option 'extended',
      'utc_offset', and the result fields 'extended' and 'is_primary', and the 'ambiguity'
      semantics for extended results.
    - Added t/16.extended_aliases.t with 6 subtests covering:
      - IANA abbreviation with the boolean option 'extended' as a no-op (CEST)
      - unambiguous single-zone extended alias (AFT -> Asia/Kabul)
      - multi-zone extended alias with 'is_primary' (AMST)
      - unknown abbreviation with and without the boolean option 'extended'
      - JST IANA offset verification; and
      - round-trip: using the returned 'zone_name' to instantiate a
        DateTime::Lite::TimeZone object.
    - Extended resolve_abbreviation() with period-based filtering and deterministic
      sort order:
      - Results are now sorted by most-recently-used first
        (MAX(trans_time) DESC), so the currently-active or most-recently-active zone
        appears first. The new result field 'last_trans_time' exposes the Unix epoch
        of that most recent transition.
      - Added optional 'period' argument to restrict results to zones whose most recent
        matching transition falls within a given time window.
        Accepts a single value or an array reference of values for multiple AND-combined
        conditions. Each value may be prefixed with a comparison operator: >, >=, <, <=.
        ISO date strings such as '1950-01-01' are converted to Unix epoch via SQLite
        strftime(); plain integers are passed as CAST(? AS INTEGER) to ensure
        arithmetic comparison.



( run in 2.755 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )