/** * @dataProvider data_shift */ public function test_shift($from_timezone, $to_timezone, $offset) { $shifted_date = Jam_Timezone::shift($this->date, new DateTimeZone($from_timezone), new DateTimeZone($to_timezone)); $this->assertEquals($offset, ($shifted_date - $this->date) / 3600); }
public function convert($value, $from, $to) { if (!$this->is_active()) { return $value; } return Jam_Timezone::shift($value, $this->{$from}(), $this->{$to}()); }