Method: TZInfo::Timezone#period_for_utc

Defined in:
lib/tzinfo/timezone.rb

#period_for_utc(utc_time) ⇒ TimezonePeriod

Returns the TZInfo::TimezonePeriod that is valid at a given time.

The UTC offset of the utc_time parameter is ignored (it is treated as a UTC time). Use the #period_for method instead if the UTC offset of the time needs to be taken into consideration.

Parameters:

Returns:

Raises:

  • (ArgumentError)

    if utc_time is nil.



425
426
427
428
# File 'lib/tzinfo/timezone.rb', line 425

def period_for_utc(utc_time)
  raise ArgumentError, 'utc_time must be specified' unless utc_time
  period_for(Timestamp.for(utc_time, :treat_as_utc))
end