Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug 274 - apiv2 was also affected by timezone bug

  • Loading branch information...
commit 55ae6ef738d4e412a213641a1261973eaf03e40d 1 parent 8c3ac28
@stevecoug stevecoug authored
Showing with 2 additions and 17 deletions.
  1. +2 −17 src/api-v2/inc/Timezone.php
View
19 src/api-v2/inc/Timezone.php
@@ -47,16 +47,7 @@ public static function getDatetimeFromUnixtime($unixtime, $timezone)
}
$datetime->setTimezone($tz);
- // How much wrong will ->format("U") be if I do it now, due to DST changes?
- // Only needed until PHP Bug #51051 delivers a better method
- $unix_offset1 = $tz->getOffset($datetime);
- $unix_offset2 = $tz->getOffset(new DateTime());
- $unix_correction = $unix_offset1 - $unix_offset2;
-
- // create datetime object corrected for DST offset
- $timestamp = $unixtime + $unix_correction;
-
- $datetime = new DateTime("@{$timestamp}");
+ $datetime = new DateTime("@{$unixtime}");
$datetime->setTimezone($tz);
return $datetime;
}
@@ -127,13 +118,7 @@ public static function UnixtimeForTimeInTimezone(
$dateObj->setDate($year, $month, $day);
$dateObj->setTime($hour, $minute, $second);
- // How much wrong will ->format("U") be if I do it now, due to DST changes?
- // Only needed until PHP Bug #51051 delivers a better method
- $unix_offset1 = $tz->getOffset($dateObj);
- $unix_offset2 = $tz->getOffset(new DateTime());
- $unix_correction = $unix_offset1 - $unix_offset2;
-
- $unixTimestamp = $dateObj->format("U") - $unix_correction;
+ $unixTimestamp = $dateObj->format("U");
return $unixTimestamp;
}
Please sign in to comment.
Something went wrong with that request. Please try again.