feat(share): save date and time for expiration - #43428
Merged
Merged
Conversation
Altahrim
force-pushed
the
feat/share-expiration-with-time
branch
7 times, most recently
from
February 9, 2024 08:02
41e359e to
719eed6
Compare
Altahrim
requested review from
a team,
ArtificialOwl,
icewind1991 and
nfebe
and removed request for
a team
February 9, 2024 08:20
Altahrim
marked this pull request as ready for review
February 9, 2024 08:20
Collaborator
Author
|
/backport to stable28 |
Collaborator
Author
|
/backport to stable27 |
Collaborator
Author
|
/backport to stable26 |
icewind1991
reviewed
Feb 9, 2024
Altahrim
force-pushed
the
feat/share-expiration-with-time
branch
6 times, most recently
from
February 13, 2024 16:28
e019241 to
ceebc38
Compare
Altahrim
force-pushed
the
feat/share-expiration-with-time
branch
from
February 19, 2024 09:13
cca99e8 to
e9733d0
Compare
Altahrim
force-pushed
the
feat/share-expiration-with-time
branch
from
February 19, 2024 10:33
e9733d0 to
a05a877
Compare
Altahrim
force-pushed
the
feat/share-expiration-with-time
branch
from
February 20, 2024 13:30
a05a877 to
bc00614
Compare
artonge
reviewed
Feb 21, 2024
|
|
||
| $expiration = $share->getExpirationDate(); | ||
| if ($expiration !== null) { | ||
| $expiration->setTimezone($this->dateTimeZone->getTimeZone()); |
Collaborator
There was a problem hiding this comment.
Am I right that the timezone is relative to the current user, logged in or not? So, in the case of a public share, the timezone of the current user will be used instead of the one from the share owner. Maybe this is only ever called from the owner perspective, so it might not be a problem.
Collaborator
Author
There was a problem hiding this comment.
You are right.
It's mainly use for display, so an user will see the right expiration date for him, even if time will probably be false.
If a share expire at 00:00:00 UTC on day D, an user in UTC-2 will see D-1 00:00:00. Time is false but ensure API compatibility.
artonge
approved these changes
Feb 22, 2024
Because of timezones, not saving time can lead to unexpected behaviour when sharing an item sooner than timezone offset Example: sharing a file before 9am when in UTC+9 Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Altahrim
force-pushed
the
feat/share-expiration-with-time
branch
from
February 22, 2024 10:26
bc00614 to
01983d5
Compare
Altahrim
enabled auto-merge
February 22, 2024 13:56
come-nc
approved these changes
Feb 26, 2024
This was referenced Feb 26, 2024
Merged
4 tasks
susnux
reviewed
Aug 21, 2024
| } | ||
|
|
||
| // Use server timezone to store the date | ||
| $date->setTimezone(new \DateTimeZone(date_default_timezone_get())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When we store an expiration date for a share, we store only the date, without time.
If an user is in UTC + 9 and share a file before 9am, the server will consider the expiration date to be one day earlier (ie. D+6 instead of D+7). Then, the display is wrong.
To fix that, we have to store time.
Fix #43457
Fix #43243
Checklist