Skip to content

Commit

Permalink
refactor: Time::getDst()
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Dec 2, 2021
1 parent 052817b commit 8cd4cd3
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions system/I18n/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -479,21 +479,7 @@ public function getQuarter(): string
*/
public function getDst(): bool
{
// grab the transactions that would affect today
$start = strtotime('-1 year', $this->getTimestamp());
$end = strtotime('+2 year', $start);
$transitions = $this->timezone->getTransitions($start, $end);

$daylightSaving = false;

foreach ($transitions as $transition) {
if ($transition['time'] > $this->format('U')) {
$daylightSaving = (bool) ($transition['isdst'] ?? $daylightSaving);
break;
}
}

return $daylightSaving;
return (bool) $this->format('I');
}

/**
Expand Down

0 comments on commit 8cd4cd3

Please sign in to comment.