Skip to content

Ticket/17624 Datetime edge case tests fail when local timezone is ahead of UTC#6947

Closed
avandenberghe wants to merge 5 commits intophpbb:masterfrom
avatharbe:ticket/17624
Closed

Ticket/17624 Datetime edge case tests fail when local timezone is ahead of UTC#6947
avandenberghe wants to merge 5 commits intophpbb:masterfrom
avatharbe:ticket/17624

Conversation

@avandenberghe
Copy link
Copy Markdown
Contributor

@avandenberghe avandenberghe commented Mar 23, 2026

Checklist:

  • Correct branch: master for new features; 3.3.x for fixes
  • Tests pass
  • Code follows coding guidelines: master and 3.3.x
  • Commit follows commit message format

Tracker ticket:

https://tracker.phpbb.com/browse/PHPBB-17624

avandenberghe and others added 3 commits March 23, 2026 15:49
The edge case test data used strtotime('yesterday'/'today'/'tomorrow')
which computes timestamps in the local timezone, then formatted them
with gmdate() which outputs in UTC. When the local timezone is ahead
of UTC, this shifts the date by one day, causing consistent failures.

Replace with time() arithmetic (time() - 86400, time(), time() + 86400)
which is timezone-agnostic and matches the pattern used by the other
test cases in the same data provider.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The edge case test data used strtotime('yesterday'/'today'/'tomorrow')
which computes timestamps in the local timezone, then formatted them
with gmdate() which outputs in UTC. When the local timezone is ahead
of UTC, this shifts the date by one day, causing consistent failures.

Replace with time() arithmetic (time() - 86400, time(), time() + 86400)
which is timezone-agnostic and matches the pattern used by the other
test cases in the same data provider.
@avandenberghe avandenberghe changed the title Ticket/17624 Ticket/17624 Datetime edge case tests fail when local timezone is ahead of UTC Mar 23, 2026
The edge case test data used strtotime('yesterday'/'today'/'tomorrow')
which computes timestamps in the local timezone, then formatted them
with gmdate() which outputs in UTC. When the local timezone is ahead
of UTC, this shifts the date by one day, causing consistent failures.

Replace with time() arithmetic (time() - 86400, time(), time() + 86400)
which is timezone-agnostic and matches the pattern used by the other
test cases in the same data provider.

PHPBB-17624
@marc1706
Copy link
Copy Markdown
Member

Thanks for your PR. I have refactored it to get rid of those not needed merge commits and also switch back to strtotime but with timezone independent calls of e.g. strtotime('now') and strtotime('-1day') which will also resolve this issue but maintain the better readability. You can seem the replacement PR based on your changes here:
#6948

@marc1706 marc1706 closed this Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants