diff --git a/lib/cocktail/schedule_state.ex b/lib/cocktail/schedule_state.ex index 8d60398..09f6ea4 100644 --- a/lib/cocktail/schedule_state.ex +++ b/lib/cocktail/schedule_state.ex @@ -37,7 +37,8 @@ defmodule Cocktail.ScheduleState do %__MODULE__{ recurrence_rules: schedule.recurrence_rules |> Enum.map(&RuleState.new/1), recurrence_times: recurrence_times_after_current_time, - exception_times: schedule.exception_times |> Enum.uniq() |> Enum.sort(&(Cocktail.Time.compare(&1, &2) in [:lt, :eq])), + exception_times: + schedule.exception_times |> Enum.uniq() |> Enum.sort(&(Cocktail.Time.compare(&1, &2) in [:lt, :eq])), start_time: schedule.start_time, current_time: current_time, duration: schedule.duration diff --git a/lib/cocktail/time.ex b/lib/cocktail/time.ex index f95a57a..44866d5 100644 --- a/lib/cocktail/time.ex +++ b/lib/cocktail/time.ex @@ -77,7 +77,6 @@ defmodule Cocktail.Time do end end - defp new_coerced_datetime(year, month, day, hour, minute, second, microsecond, timezone) do days_in_month_b = :calendar.last_day_of_the_month(year, month) @@ -340,6 +339,6 @@ defmodule Cocktail.Time do def parse(_, _), do: {:error, :invalid_format} defp get_time_zone_datebase do - Application.get_env(:elixir, :time_zone_database, Tzdata.TimeZoneDatabase) + Application.get_env(:elixir, :time_zone_database) end end diff --git a/mix.exs b/mix.exs index 87ae72e..8551fa3 100644 --- a/mix.exs +++ b/mix.exs @@ -81,7 +81,7 @@ defmodule Cocktail.Mixfile do {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false}, {:ex_doc, "~> 0.23", only: :dev, runtime: false}, {:excoveralls, "~> 0.10", only: :test}, - {:tzdata, "~> 1.1"} + {:tzdata, "~> 1.1", only: :test} ] end end diff --git a/test/cocktail/monthly_test.exs b/test/cocktail/monthly_test.exs index f0f7b00..7d5824a 100644 --- a/test/cocktail/monthly_test.exs +++ b/test/cocktail/monthly_test.exs @@ -138,13 +138,13 @@ defmodule Cocktail.MonthlyTest do |> Schedule.add_recurrence_rule(:monthly, interval: 3) assert first_n_occurrences(schedule, 7) == [ - ~U[2017-01-02 06:00:00Z], - ~U[2017-03-02 06:00:00Z], - ~U[2017-04-02 06:00:00Z], - ~U[2017-05-02 06:00:00Z], - ~U[2017-07-02 06:00:00Z], - ~U[2017-09-02 06:00:00Z], - ~U[2017-10-02 06:00:00Z] + ~Y[2017-01-02 06:00:00 Etc/UTC], + ~Y[2017-03-02 06:00:00 Etc/UTC], + ~Y[2017-04-02 06:00:00 Etc/UTC], + ~Y[2017-05-02 06:00:00 Etc/UTC], + ~Y[2017-07-02 06:00:00 Etc/UTC], + ~Y[2017-09-02 06:00:00 Etc/UTC], + ~Y[2017-10-02 06:00:00 Etc/UTC] ] assert_icalendar_preserved(schedule) diff --git a/test/test_helper.exs b/test/test_helper.exs index 580d1cc..18ff609 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,4 +1,4 @@ ExUnit.configure(exclude: [pending: true], formatters: [ExUnit.CLIFormatter, ExUnitNotifier]) ExUnit.start() - +Application.put_env(:elixir, :time_zone_database, Tzdata.TimeZoneDatabase) Code.require_file("test/support/datetime_sigil.ex")