Skip to content

w2p_Utilities_Date::format('%I') drops the leading zero (testFormatTZAwareTimeWithFormat fails before 10:00) #426

Closed

Description

@caseysoftware

Found on the dev-6.0.0 branch (local, at 9bd3a1e0) during the lib/ cleanup. It may be on master too: the same code is there.

w2p_Utilities_Date::format() maps %I (12-hour clock, two digits) to date('g'), which has no leading zero (classes/w2p/Utilities/Date.class.php, case 'I').

  • Any user whose time format uses %I sees times like 1:03 am instead of 01:03 am.
  • w2p_Core_CAppUITest::testFormatTZAwareTimeWithFormat compares against PHP's h format, so it fails whenever the current hour is 1–9 (am or pm) and passes otherwise. The suite result depends on the time of day.

Fix: use date('h', $myTime) for %I. If an unpadded hour is wanted, add %l (strftime's code for that) and map it to g.

Activity

  1. added
    php
    on Oct 21, 2026
  2. added a commit that references this issue on Oct 21, 2026
    7bf5328
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    phptesting

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions