29 if (!in_array(
$timezone, timezone_identifiers_list())) {
30 throw new \InvalidArgumentException(
"$timezone is not a valid timezone identifier", 1);
32 $this->timezone = new \DateTimeZone(
$timezone);
40 if (!$from instanceof \DateTimeImmutable) {
41 throw new \InvalidArgumentException(
"$from is not a DateTimeImmutable-object", 1);
44 $ts = $from->format(
'Y-m-d H:i:s');
45 $to = new \DateTimeImmutable($ts, $this->timezone);
An exception for terminatinating execution or to throw for unit testing.
Change the timezone (and only the timezone) of php's \DateTimeImmutable WITHOUT changing the date-val...
__invoke($from)
Transformations should be callable.This MUST do the same as transform.InvalidArgumentException if the...
__construct(string $timezone)
transform($from)
Perform the transformation.Please use this for transformations. It's more performant than calling inv...
trait DeriveApplyToFromTransform