Calendar.TimeZoneDatabase.time_zone_periods_from_wall_datetime
time_zone_periods_from_wall_datetime
, go back to Calendar.TimeZoneDatabase module for more information.
Specs
time_zone_periods_from_wall_datetime( Calendar.naive_datetime(), Calendar.time_zone() ) :: {:ok, time_zone_period()} | {:ambiguous, time_zone_period(), time_zone_period()} | {:gap, {time_zone_period(), time_zone_period_limit()}, {time_zone_period(), time_zone_period_limit()}} | {:error, :time_zone_not_found | :utc_only_time_zone_database}
Possible time zone periods for a certain time zone and wall clock date and time.
When the provided datetime
is ambiguous a tuple with :ambiguous
and two possible
periods. The periods in the list are sorted with the first element being the one that begins first.
When the provided datetime
is in a gap - for instance during the "spring forward" when going
from winter time to summer time, a tuple with :gap
and two periods with limits are returned
in a nested tuple. The first nested two-tuple is the period before the gap and a naive datetime
with a limit for when the period ends (wall time). The second nested two-tuple is the period
just after the gap and a datetime (wall time) for when the period begins just after the gap.
If there is only a single possible period for the provided datetime
, then a tuple with :ok
and the time_zone_period
is returned.