Changeset 59959
- Timestamp:
- 03/10/2025 02:57:21 PM (7 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/functions/wpTimezoneOverrideOffset.php
r59936 r59959 34 34 'UTC option set' => array( 'UTC', 0.0 ), 35 35 'EST option set' => array( 'EST', -5.0 ), 36 'NST option set' => array( 'America/St_Johns', -3.5 ),36 'NST option set' => array( 'America/St_Johns', $this->is_timezone_in_dst( 'America/St_Johns' ) ? -2.5 : -3.5 ), 37 37 ); 38 38 } 39 40 /** 41 * Determines whether the current timezone offset is observing daylight saving time (DST). 42 * 43 * @param string $timezone_string The timezone identifier (e.g., 'America/St_Johns'). 44 * @return bool Whether the timezone is observing DST. 45 */ 46 private function is_timezone_in_dst( $timezone_string ) { 47 $timezone = new DateTimeZone( $timezone_string ); 48 $timestamp = time(); 49 $transitions = $timezone->getTransitions( $timestamp, $timestamp ); 50 51 if ( false === $transitions || ! is_array( $transitions ) || ! isset( $transitions[0]['isdst'] ) ) { 52 return false; 53 } 54 55 return $transitions[0]['isdst']; 56 } 39 57 }
Note: See TracChangeset
for help on using the changeset viewer.