-
Notifications
You must be signed in to change notification settings - Fork 29
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
IBX-801: Fixed timezone for DateTime fields in content name pattern #216
base: 1.3
Are you sure you want to change the base?
Conversation
@ezsystems/php-dev-team |
I was pretty sure this was already fixed in #181, #185 and #187. Anyway, the root issue is that EDIT: I think that
|
As per edited part, I think that
should be changed to respect server timezone setting. @mateuszdebinski did we have any issues that prevented us from changing this particular line of code? I remember we were talking about replacing instances where timezone is passed via |
@Steveb-p followed your advice. Also please keep in mind https://www.php.net/manual/en/class.datetime.php#99309. Seem like |
It's not required if |
Sorry, I just want to make this statement more clear:
|
@SerheyDolgushev yes, although I personally prefer public static function fromTimestamp($timestamp)
{
try {
- return new static(new DateTime("@{$timestamp}"));
+ $datetime = new DateTime();
+ $datetime->setTimestamp($timestamp);
+
+ return new static($datetime);
} catch (Exception $e) {
throw new InvalidArgumentValue('$timestamp', $timestamp, __CLASS__, $e);
}
} solution as it doesn't involve manually creating |
But |
If So no, only creating a This can be circumvented by setting timestamp using As I said, I personally prefer the |
2bd2545
to
0078326
Compare
@Steveb-p done |
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, but @mateuszdebinski should take a look, and it has to go through QA.
I'm pretty sure there was a reason why we didn't immediately fix those, but can't remember why right now.
Should we target |
0078326
to
64bac60
Compare
Rebased against |
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.
Should we target
master
branch only with that? It seems that publish7.5
or at least1.3
platform is a valid one.
@ViniTou is right. This fix belongs to ezpublish-kernel:7.5, therefore can't be applied here.
Moreover test coverage is required, as we discussed many many times.
we talked about introducing for DateAndTime as well, but it wasn't done, we probably missed it. From what I remember, corrections had to be made in several tests - including those for SOLR. QA should also verify the search by date because I know that there were problems with this in previous changes as well |
@mateuszdebinski could you elaborate on that? How is it possible? |
@alongosz eZ Platform 2.5 does not create a draft and then edit it like Ibexa DXP 3, therefore all timestamp offsets are generated by js, which retrieves timezone information and modifies the timestamp for UTC accordingly, which is then sent to the server and saved, therefore this the problem does not exist in 2.5 |
If frontend adds timezone offset into timestamp in 2.5, then this issue becomes even worse. If timestamps are stored in database as they're received (not as date strings) then this would lead to an issue with data becoming invalid when migrating between 2.5 -> 3.3, since now we would add offsets on the backend. And then we would store the timestamps properly in 3.3, which would lead to timestamps saved in 2.5 to be impossible to distinguish between new ones and therefore impossible to properly migrate. |
@mateuszdebinski the fact that the issue is not visible does not mean it does not exist. From the API perspective the code works the same, regardless of UI. API is also part of 2.5. Does applying the fix for 2.5 require changes to UI layer? |
@ezsystems/php-dev-team sorry, any update on this one? |
@SerheyDolgushev thanks for the reminder. @mateuszdebinski I summon thee. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@alongosz Not only does UI require changes if we want to implement changes to Date and DateAndTime fields in eZ Platform 2.5 because in DB we have a timestamp with offset. If we change only API and UI then show incorrect data in created contents. @Steveb-p we need to adapt the current tests to this change in this PR before sending to QA |
Timestamp value is stored as Unix Epoch Timestamp in |
@alongosz someone borked the code and the offset got added into Which basically means that we / users would have to:
Otherwise we will have no way of knowing which field contains a "corrupted" timestamp, and which are fine (coming from patched version). EDIT: To rephrase, someone was facing an issue that EDIT2: Basically this:
|
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.
@mateuszdebinski ok, based on internal sync with @Steveb-p I'll allow skipping 2.5 for now, given the full stack there works and it would affect more people, therefore more risky.
What we need here is:
- Align tests
- Provide 3.3 upgrade script because the issue of incorrectly stored timestamps as you described is valid for 3.3 instances as well. It should be SQL upgrade script, not a command.
I assume all of the required changes are going to be implemented by @ezsystems/php-dev-team. |
v3.3.6
Steps to reproduce
date.timezone
is set toAmerica/New_York
(or any other but not UTC)<name> <date>
"Content name pattern".Expected result
The new event content item should have "Meeting Tue 2021-31-08 14:00:00" name.
Actual result
The new event content item's name is "Meeting Tue 2021-31-08 18:00:00".
Checklist:
$ composer fix-cs
).@ezsystems/php-dev-team
).