-
Notifications
You must be signed in to change notification settings - Fork 2
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
DRAFT: Fix dst-transition-leap spreading to subsequent events #101
Conversation
6dbb10b
to
882a18e
Compare
882a18e
to
90e3154
Compare
7ff600f
to
d9f246d
Compare
…e timezone guesser test
d9f246d
to
19d0ed4
Compare
private function revertPastOffset(\DateTimeInterface $dateTime): \DateTimeInterface | ||
{ | ||
if (!is_numeric($this->counter)) { | ||
return $dateTime; | ||
} | ||
|
||
$previousIterationLeapOffset = $this->leapOffset[(int) $this->counter - 1] ?? null; | ||
|
||
if (!is_int($previousIterationLeapOffset)) { | ||
return $dateTime; | ||
} | ||
|
||
$modifiedDateTime = $dateTime->modify("- $previousIterationLeapOffset seconds"); | ||
|
||
unset($this->leapOffset[$this->counter - 1]); | ||
|
||
return $modifiedDateTime; | ||
} | ||
|
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.
if you are anyway always resetting the previous offset, why keep a list of them? 🤔
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.
Before my last commit, it was possible to call this method and "detectAndSaveDstOffset" multiple times per iteration. It's probably not needed anymore indeed
I'm not satisfied with the approach altogether. It's error-prone and not really future proof. I'll close this and submit a bug report upstream |
No description provided.