Skip to content

Conversation

@come-nc
Copy link
Contributor

@come-nc come-nc commented Apr 2, 2024

Summary

Fix the quite corner case we are currently having in CI: recent daytime saving time change in Europe is making the share date expiration test fail.
Somehow the tests are also not correctly independent and having this one fail messed up 6 others, by leaving behind a hook expectation it seems.

The bug comes from the order of timezone change and day removal, if you change timezone first and remove 2 days after you do not get the same hours as if you do it the other way around.
Can be tested with this:

<?php

$timezone = new \DateTimeZone('Pacific/Auckland');
$nextWeek = new \DateTime('now', $timezone);
$nextWeek->add(new \DateInterval('P7D'));

$save = clone $nextWeek;
$save->setTime(0, 0);
$save->sub(new \DateInterval('P2D'));
$save->setTimezone(new \DateTimeZone(date_default_timezone_get()));

$save2 = clone $nextWeek;
$save2->setTime(0, 0);
$save2->setTimezone(new \DateTimeZone(date_default_timezone_get()));
$save2->sub(new \DateInterval('P2D'));
		
var_dump(
    $nextWeek,
    $save,
    $save2,
);

Current output (on 2024-04-02):

object(DateTime)#2 (3) {
  ["date"]=>
  string(26) "2024-04-09 22:29:22.491335"
  ["timezone_type"]=>
  int(3)
  ["timezone"]=>
  string(16) "Pacific/Auckland"
}
object(DateTime)#3 (3) {
  ["date"]=>
  string(26) "2024-04-06 13:00:00.000000"
  ["timezone_type"]=>
  int(3)
  ["timezone"]=>
  string(16) "Europe/Amsterdam"
}
object(DateTime)#4 (3) {
  ["date"]=>
  string(26) "2024-04-06 14:00:00.000000"
  ["timezone_type"]=>
  int(3)
  ["timezone"]=>
  string(16) "Europe/Amsterdam"
}

Checklist

@come-nc come-nc requested a review from Altahrim April 2, 2024 09:25
@come-nc come-nc self-assigned this Apr 2, 2024
@come-nc come-nc requested review from a team, ArtificialOwl, icewind1991 and sorbaugh and removed request for a team April 2, 2024 09:31
@come-nc come-nc added the 3. to review Waiting for reviews label Apr 2, 2024
@come-nc come-nc added this to the Nextcloud 30 milestone Apr 2, 2024
@come-nc come-nc added the tests Related to tests label Apr 2, 2024
@come-nc
Copy link
Contributor Author

come-nc commented Apr 2, 2024

/backport to stable29

@come-nc
Copy link
Contributor Author

come-nc commented Apr 2, 2024

/backport to stable28

@come-nc
Copy link
Contributor Author

come-nc commented Apr 2, 2024

/backport to stable27

@come-nc come-nc enabled auto-merge April 2, 2024 10:14
@backportbot
Copy link

backportbot bot commented Apr 2, 2024

The backport to stable29 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable29
git pull origin stable29

# Create the new backport branch
git checkout -b backport/44612/stable29

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick fda1c42a

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/44612/stable29

Error: Failed to push branch backport/44612/stable29: fatal: could not read Username for 'https://github.com': No such device or address


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@come-nc
Copy link
Contributor Author

come-nc commented Apr 2, 2024

/backport to stable29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants