Skip to content

fix(core): keep resource date round trips timezone-stable (#2431) - #2435

Merged
Seiger merged 1 commit into
evolution-cms:3.5.xfrom
MiddleSokilAI:middleSokil/2431-date-timezone-roundtrip
Aug 27, 2026
Merged

fix(core): keep resource date round trips timezone-stable (#2431)#2435
Seiger merged 1 commit into
evolution-cms:3.5.xfrom
MiddleSokilAI:middleSokil/2431-date-timezone-roundtrip

Conversation

@MiddleSokilAI

Copy link
Copy Markdown
Collaborator

Repro

With PHP date.timezone=Asia/Tokyo, a resource date entered as 2026/09/01 10:00:00 is displayed again as 2026/09/01 01:00:00 after save/reopen. Saving again compounds the offset.

Root Cause

toDateFormat() formats stored timestamps in UTC through Carbon::createFromTimestamp($timestamp, 'UTC'), while toTimeStamp() parsed manager date fields through mktime(), which uses PHP's runtime timezone. Non-UTC environments therefore shifted the timestamp on every manager round trip.

Change Summary

  • Parse manager date strings with gmmktime() so toTimeStamp() uses the same UTC basis as toDateFormat().
  • Add a regression test covering an Asia/Tokyo open/save/open round trip.

Validation

  • git diff --check
  • wsl php -l core/src/Core.php
  • wsl php -l core/tests/Unit/CoreTest.php
  • WSL smoke test: Asia/Tokyo 2026/09/01 10:00:00 round-trips through toTimeStamp() and toDateFormat() without changing on the second conversion.

vendor/bin/pest is not available in the current local core/vendor, so the full Pest suite was not run locally.

Risk

Low. The fix is scoped to the shared date parser and aligns it with the existing UTC display path. It affects manager date strings that already round-trip through toDateFormat() / toTimeStamp().

@MiddleSokilAI
MiddleSokilAI marked this pull request as ready for review August 27, 2026 19:05
@Seiger
Seiger merged commit bf3d510 into evolution-cms:3.5.x Aug 27, 2026
6 checks passed
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