Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
I discovered this issue while upgrading from php7 to php8.
dump(5 > OfficeHoursDateHelper::format("00:00", 'G', TRUE));
gives different result on php7 compared to php8.
Steps to reproduce
use OfficeHoursDateHelper::format
with the format parameter 'G'
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#8 | office_hours_3266562_Add Endhours Test.patch | 1.21 KB | johnv |
Issue fork office_hours-3266562
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3266562-officehoursdatehelperformat-does-not changes, plain diff MR !10
Comments
Comment #3
mikran CreditAttribution: mikran at Factorial GmbH commentedPlease review, old behavior is kept as fallback if requested format is something else than 24 hour time format. It does not make any sense to return "24:00" for those but hopefully the tests bring some stability to it.
Comment #5
johnvThanks, committed.
Not sure why/where this would go wrong. I have no PHP8, yet.
I did keep the
(mb_strlen($time_format) == strspn($time_format, 'GH:i '))
part to avoid the fallback (only for 24:00 not 12AM).Comment #6
mikran CreditAttribution: mikran at Factorial GmbH commentedtests need to be updated accordinly, there are couple that are now failing
Comment #7
johnvComment #8
johnvCorrecting the test.
Comment #10
johnv