GetCustomTimeZoneCreationParams method

CustomTimeZoneCreateParams GetCustomTimeZoneCreationParams()
Gets the offset to UTC based on this group's transitions.

Implementation

CustomTimeZoneCreateParams GetCustomTimeZoneCreationParams() {
  CustomTimeZoneCreateParams result = CustomTimeZoneCreateParams();

  if (TransitionToDaylight != null) {
    result.DaylightDisplayName = TransitionToDaylight!.TargetPeriod!.Name;
  }

  result.StandardDisplayName = TransitionToStandard!.TargetPeriod!.Name;

  // Assume that the standard period's offset is the base offset to UTC.
  // EWS returns a positive offset for time zones that are behind UTC, and
  // a negative one for time zones ahead of UTC. TimeZoneInfo does it the other
  // way around.
  result.BaseOffsetToUtc = TimeSpan(
    -TransitionToStandard!.TargetPeriod!.Bias!.time,
  );

  return result;
}