-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Clock] DatePoint created with fixed date should be set at midnight #54497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
Keeping the current type in that case looks like a bug to me. /cc @nicolas-grekas |
In the meanwhile (as temporary solution), you can leverage $datePoint = DatePoint::createFromFormat('Y-m-d|', '2024-01-01');
$immutableDate = \DateTimeImmutable::createFromFormat('Y-m-d|', '2024-01-01');
self::assertEquals('2024-01-01 00:00:00', $datePoint->format('Y-m-d H:i:s')); // Pass
self::assertEquals('2024-01-01 00:00:00', $immutableDate->format('Y-m-d H:i:s')); // Pass |
@stof you mean s/type/time ? |
see #54530 |
@OskarStark indeed. |
xabbuh
added a commit
that referenced
this issue
Apr 11, 2024
…odifying the date (xabbuh) This PR was merged into the 6.4 branch. Discussion ---------- [Clock] initialize the current time with midnight before modifying the date | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #54497 | License | MIT Commits ------- 260b834 initialize the current time with midnight before modifying the date
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected
6.4.5
Description
PHP: 8.1
I would expect that the behavior of DatePoint does not differ from DateTimeImmutable to use as a pure replacement. However, I cannot use it as it is everywhere (including in test cases) because creating a date with a fixed date keep the current time.
See the repro below.
How to reproduce
Possible Solution
Additional Context
No response
The text was updated successfully, but these errors were encountered: