Skip to content

Commit

Permalink
Merge pull request #338 from JarvusInnovations/develop
Browse files Browse the repository at this point in the history
Release: v1.20.3
  • Loading branch information
themightychris authored Mar 22, 2022
2 parents cd87f27 + 5361ac3 commit a812df5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions php-classes/ActiveRecord.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2367,13 +2367,17 @@ protected function _setFieldValue($field, $value)
} elseif (is_numeric($value)) {
static $offsetTimezone;

// when MySQL only supports offset-based timezones, use same offset timezone to render dates without transition-awareness
if ($offsetTimezone === null) {
$offsetTimezone = static::getDatabaseOffsetTimezone();
if (version_compare(PHP_VERSION, '5.6.0') >= 0) {
$offsetTimezone = static::getDatabaseOffsetTimezone();

if ($offsetTimezone) {
// $offsetTimezone = new DateTimeZone($offsetTimezone);
// work around PHP 5.5 bug (fixed in 5.6): https://stackoverflow.com/a/14069062/964125
$offsetTimezone = DateTime::createFromFormat('O', $offsetTimezone)->getTimezone();
if ($offsetTimezone) {
$offsetTimezone = new DateTimeZone($offsetTimezone);
}
} else {
// PHP <5.6 has various DateTime/DateTimeZone issues, so don't even bother trying to correct issues
$offsetTimezone = false;
}
}

Expand Down

0 comments on commit a812df5

Please sign in to comment.