Skip to content

Commit ec898f7

Browse files
authored
Merge pull request #5415 from kenjis/fix-time-getdst
refactor: Time::getDst()
2 parents a142a7a + bb82f4e commit ec898f7

1 file changed

Lines changed: 1 addition & 15 deletions

File tree

system/I18n/Time.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -479,21 +479,7 @@ public function getQuarter(): string
479479
*/
480480
public function getDst(): bool
481481
{
482-
// grab the transactions that would affect today
483-
$start = strtotime('-1 year', $this->getTimestamp());
484-
$end = strtotime('+2 year', $start);
485-
$transitions = $this->timezone->getTransitions($start, $end);
486-
487-
$daylightSaving = false;
488-
489-
foreach ($transitions as $transition) {
490-
if ($transition['time'] > $this->format('U')) {
491-
$daylightSaving = (bool) ($transition['isdst'] ?? $daylightSaving);
492-
break;
493-
}
494-
}
495-
496-
return $daylightSaving;
482+
return $this->format('I') === '1'; // 1 if Daylight Saving Time, 0 otherwise.
497483
}
498484

499485
/**

0 commit comments

Comments
 (0)