Class

TZInfo::TimezonePeriod

Inheritance
< Object

A period of time in a timezone where the same offset from UTC applies.

All the methods that take times accept instances of Time, DateTime or integer timestamps.

Attributes

Name Visibility R/W Description
end_transition public R The TimezoneTransitionInfo that defines the end of this TimezonePeriod (may be nil if unbounded).
offset public R The TimezoneOffsetInfo for this period.
start_transition public R The TimezoneTransitionInfo that defines the start of this TimezonePeriod (may be nil if unbounded).

Methods

Class

Visibility Signature
public new (start_transition, end_transition, offset = nil)

Instance

Visibility Signature
public == (p)
public abbreviation ()
public dst? ()
public eql? (p)
public hash ()
public inspect ()
public local_after_start? (local)
public local_before_end? (local)
public local_end ()
public local_start ()
public std_offset ()
public to_local (utc)
public to_utc (local)
public utc_after_start? (utc)
public utc_before_end? (utc)
public utc_end ()
public utc_offset ()
public utc_start ()
public utc_total_offset ()
public utc_total_offset_rational ()
public valid_for_local? (local)
public valid_for_utc? (utc)
public zone_identifier ()

Class Method Detail

new(start_transition, end_transition, offset = nil)

Initializes a new TimezonePeriod.

Instance Method Detail

==(p)

Returns true if this TimezonePeriod is equal to p. This compares the start_transition, end_transition and offset using ==.

abbreviation()

The identifier of this period, e.g. "GMT" (Greenwich Mean Time) or "BST" (British Summer Time) for "Europe/London". The returned identifier is a symbol.

dst?()

true if daylight savings is in effect for this period; otherwise false.

eql?(p)

Returns true if this TimezonePeriods is equal to p. This compares the start_transition, end_transition and offset using eql?

hash()

Returns a hash of this TimezonePeriod.

inspect()

Returns internal object state as a programmer-readable string.

local_after_start?(local)

true if the given local DateTime is after the start of the period (inclusive); otherwise false.

local_before_end?(local)

true if the given local DateTime is before the end of the period (exclusive); otherwise false.

local_end()

The end time of the period in local time as a DateTime. May be nil if unbounded.

local_start()

The start time of the period in local time as a DateTime. May be nil if unbounded.

std_offset()

Offset from the local time where daylight savings is in effect (seconds). E.g.: utc_offset could be -5 hours. Normally, std_offset would be 0. During daylight savings, std_offset would typically become +1 hours.

to_local(utc)

Converts a UTC DateTime to local time based on the offset of this period.

to_utc(local)

Converts a local DateTime to UTC based on the offset of this period.

utc_after_start?(utc)

true if the given UTC DateTime is after the start of the period (inclusive); otherwise false.

utc_before_end?(utc)

true if the given UTC DateTime is before the end of the period (exclusive); otherwise false.

utc_end()

The end time of the period in UTC as a DateTime. May be nil if unbounded.

utc_offset()

Base offset of the timezone from UTC (seconds).

utc_start()

The start time of the period in UTC as a DateTime. May be nil if unbounded.

utc_total_offset()

Total offset from UTC (seconds). Equal to utc_offset + std_offset.

utc_total_offset_rational()

Total offset from UTC (days). Result is a Rational.

valid_for_local?(local)

true if this period is valid for the given local DateTime; otherwise false.

valid_for_utc?(utc)

true if this period is valid for the given UTC DateTime; otherwise false.

zone_identifier()

Alias for abbreviation