-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix: Time::setTimestamp()'s different behavior than DateTime #9106
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a changelog entry for this.
1355800
to
f2fb30c
Compare
We do not fix the bug in TimeLegacy.
f2fb30c
to
9395543
Compare
Added docs. |
* | ||
* @return static | ||
* | ||
* @throws Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the docs for the setTimestamp
method, it mentions that an Exception may be thrown, but the method itself does not handle any exceptions directly. Should an appropriate exception be thrown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parent class (DateTimeImmutable
) throws Exception
.
CI is kind of thin wrapper for PHP, so I don't think it's necessary to change PHP's behavior unless there is a need to do so.
|
||
echo $time2->format('Y-m-d H:i:s P'); | ||
// Before: 2024-08-20 00:00:00 -05:00 | ||
// After: 2024-08-19 19:00:00 -05:00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// After: 2024-08-19 19:00:00 -05:00 | |
// After: 2024-08-19 19:00:00 -05:00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The :
symbols have been aligned for easier reading.
|
||
echo $time2->format('Y-m-d H:i:s P'); | ||
// Before: 2024-08-20 00:00:00 -05:00 | ||
// After: 2024-08-20 00:00:00 -05:00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// After: 2024-08-20 00:00:00 -05:00 | |
// After: 2024-08-20 00:00:00 -05:00 |
Time::setTimestamp() Behavior Fix | ||
================================= | ||
|
||
In previous versions, if you call ``Time::setTimestamp()`` on a Time instance with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it better to use this?
In previous versions, if you call ``Time::setTimestamp()`` on a Time instance with | |
In previous versions, if you call :php:meth:`Time::setTimestamp()` on a Time instance with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:php:meth:
makes a link to the class reference.
But there is no class reference for Time::setTimestamp()
method.
Class reference is something like the following:
https://codeigniter4.github.io/CodeIgniter4/outgoing/view_renderer.html#namespace-CodeIgniter\View
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
Description
Follow-up #9105
Checklist: