Packages

Calculating Azan times for a given location

Current section

4 Versions

Jump to

Compare versions

5 files changed
+44 additions
-43 deletions
  @@ -1,7 +1,9 @@
1 - {<<"app">>,<<"azan_ex">>}.
2 - {<<"build_tools">>,[<<"mix">>]}.
1 + {<<"links">>,[{<<"GitHub">>,<<"https://github.com/drselump14/azan_ex">>}]}.
2 + {<<"name">>,<<"azan_ex">>}.
3 + {<<"version">>,<<"0.3.0">>}.
3 4 {<<"description">>,<<"Calculating Azan times for a given location">>}.
4 5 {<<"elixir">>,<<"~> 1.13">>}.
6 + {<<"app">>,<<"azan_ex">>}.
5 7 {<<"files">>,
6 8 [<<"lib">>,<<"lib/azan.ex">>,<<"lib/azan">>,<<"lib/azan/prayer_time.ex">>,
7 9 <<"lib/azan/calculation_parameter.ex">>,<<"lib/azan/date_utils.ex">>,
  @@ -18,37 +20,35 @@
18 20 <<"lib/azan/dhuhr_time.ex">>,<<"lib/azan/astronomy_utility.ex">>,
19 21 <<"mix.exs">>,<<"README.md">>,<<"LICENSE.md">>]}.
20 22 {<<"licenses">>,[<<"MIT">>]}.
21 - {<<"links">>,[{<<"GitHub">>,<<"https://github.com/drselump14/azan_ex">>}]}.
22 - {<<"name">>,<<"azan_ex">>}.
23 23 {<<"requirements">>,
24 - [[{<<"app">>,<<"decimal">>},
25 - {<<"name">>,<<"decimal">>},
24 + [[{<<"name">>,<<"decimal">>},
25 + {<<"app">>,<<"decimal">>},
26 26 {<<"optional">>,false},
27 - {<<"repository">>,<<"hexpm">>},
28 - {<<"requirement">>,<<"~> 2.0">>}],
29 - [{<<"app">>,<<"domo">>},
30 - {<<"name">>,<<"domo">>},
27 + {<<"requirement">>,<<"~> 2.0">>},
28 + {<<"repository">>,<<"hexpm">>}],
29 + [{<<"name">>,<<"domo">>},
30 + {<<"app">>,<<"domo">>},
31 31 {<<"optional">>,false},
32 - {<<"repository">>,<<"hexpm">>},
33 - {<<"requirement">>,<<"~> 1.5.10">>}],
34 - [{<<"app">>,<<"ex_machina">>},
35 - {<<"name">>,<<"ex_machina">>},
32 + {<<"requirement">>,<<"~> 1.5.10">>},
33 + {<<"repository">>,<<"hexpm">>}],
34 + [{<<"name">>,<<"ex_machina">>},
35 + {<<"app">>,<<"ex_machina">>},
36 36 {<<"optional">>,false},
37 - {<<"repository">>,<<"hexpm">>},
38 - {<<"requirement">>,<<"~> 2.7.0">>}],
39 - [{<<"app">>,<<"math">>},
40 - {<<"name">>,<<"math">>},
37 + {<<"requirement">>,<<"~> 2.8.0">>},
38 + {<<"repository">>,<<"hexpm">>}],
39 + [{<<"name">>,<<"math">>},
40 + {<<"app">>,<<"math">>},
41 41 {<<"optional">>,false},
42 - {<<"repository">>,<<"hexpm">>},
43 - {<<"requirement">>,<<"~> 0.7.0">>}],
44 - [{<<"app">>,<<"timex">>},
45 - {<<"name">>,<<"timex">>},
42 + {<<"requirement">>,<<"~> 0.7.0">>},
43 + {<<"repository">>,<<"hexpm">>}],
44 + [{<<"name">>,<<"timex">>},
45 + {<<"app">>,<<"timex">>},
46 46 {<<"optional">>,false},
47 - {<<"repository">>,<<"hexpm">>},
48 - {<<"requirement">>,<<"~> 3.7">>}],
49 - [{<<"app">>,<<"typed_struct">>},
50 - {<<"name">>,<<"typed_struct">>},
47 + {<<"requirement">>,<<"~> 3.7">>},
48 + {<<"repository">>,<<"hexpm">>}],
49 + [{<<"name">>,<<"typed_struct">>},
50 + {<<"app">>,<<"typed_struct">>},
51 51 {<<"optional">>,false},
52 - {<<"repository">>,<<"hexpm">>},
53 - {<<"requirement">>,<<"~> 0.3.0">>}]]}.
54 - {<<"version">>,<<"0.2.0">>}.
52 + {<<"requirement">>,<<"~> 0.3.0">>},
53 + {<<"repository">>,<<"hexpm">>}]]}.
54 + {<<"build_tools">>,[<<"mix">>]}.
  @@ -101,6 +101,7 @@ defmodule Azan.CalculationMethod do
101 101 |> CalculationParameter.adjust_by_method(:dhuhr, 1)
102 102 end
103 103
104 + @spec tehran() :: CalculationParameter.t()
104 105 def tehran do
105 106 %CalculationParameter{
106 107 method: :tehran,
  @@ -25,11 +25,11 @@ defmodule Azan.PolarCircleResolution do
25 25 field :tomorrow_solar_time, SolarTime.t()
26 26 end
27 27
28 - def is_valid_solar_time(%SolarTime{sunrise: sunrise, sunset: sunset})
28 + def valid_solar_time?(%SolarTime{sunrise: sunrise, sunset: sunset})
29 29 when is_number(sunrise) and is_number(sunset),
30 30 do: true
31 31
32 - def is_valid_solar_time(%SolarTime{}), do: false
32 + def valid_solar_time?(%SolarTime{}), do: false
33 33
34 34 def aqrab_yaum_resolver(
35 35 coordinate,
  @@ -54,7 +54,7 @@ defmodule Azan.PolarCircleResolution do
54 54 solar_time = SolarTime.new(epoch_date, coordinate)
55 55 tomorrow_solar_time = SolarTime.new(tomorrow, coordinate)
56 56
57 - case is_valid_solar_time(solar_time) && is_valid_solar_time(tomorrow_solar_time) do
57 + case valid_solar_time?(solar_time) && valid_solar_time?(tomorrow_solar_time) do
58 58 true ->
59 59 %__MODULE__{
60 60 date: date,
  @@ -81,7 +81,7 @@ defmodule Azan.PolarCircleResolution do
81 81 tomorrow = date |> Timex.shift(days: 1)
82 82 tomorrow_solar_time = tomorrow |> SolarTime.new(new_coordinate)
83 83
84 - case is_valid_solar_time(solar_time) && is_valid_solar_time(tomorrow_solar_time) do
84 + case valid_solar_time?(solar_time) && valid_solar_time?(tomorrow_solar_time) do
85 85 true ->
86 86 %__MODULE__{
87 87 date: date,
  @@ -65,13 +65,13 @@ defmodule Azan.PrayerTime do
65 65 }
66 66 iex> coordinate |> PrayerTime.find(date, params)
67 67 %Azan.PrayerTime{
68 - asr: ~U[2022-10-01 05:51:00Z],
69 - dhuhr: ~U[2022-10-01 02:35:00Z],
68 + asr: ~U[2022-10-01 05:51:00.000000Z],
69 + dhuhr: ~U[2022-10-01 02:35:00.000000Z],
70 70 fajr: ~U[2022-09-30 19:10:00Z],
71 - isha: ~U[2022-10-01 09:43:00Z],
72 - maghrib: ~U[2022-10-01 08:28:00Z],
73 - sunrise: ~U[2022-09-30 20:35:00Z],
74 - sunset: ~U[2022-10-01 08:25:00Z]
71 + isha: ~U[2022-10-01 09:43:00.000000Z],
72 + maghrib: ~U[2022-10-01 08:28:00.000000Z],
73 + sunrise: ~U[2022-09-30 20:35:00.000000Z],
74 + sunset: ~U[2022-10-01 08:25:00.000000Z]
75 75 }
76 76
77 77 """
  @@ -7,7 +7,7 @@ defmodule Azan.Azan.MixProject do
7 7 def project do
8 8 [
9 9 app: :azan_ex,
10 - version: "0.2.0",
10 + version: "0.3.0",
11 11 elixir: "~> 1.13",
12 12 compilers: [:domo_compiler] ++ Mix.compilers(),
13 13 start_permanent: Mix.env() == :prod,
  @@ -50,15 +50,15 @@ defmodule Azan.Azan.MixProject do
50 50 {:credo, "~> 1.6", only: [:dev, :test], runtime: false},
51 51 {:decimal, "~> 2.0"},
52 52 {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
53 - {:doctor, "~> 0.19.0", only: :dev},
53 + {:doctor, "~> 0.22.0", only: :dev},
54 54 {:domo, "~> 1.5.10"},
55 55 {:excoveralls, "~> 0.10", only: [:dev, :test]},
56 56 {:ex_doc, "~> 0.27", only: :dev, runtime: false},
57 - {:ex_machina, "~> 2.7.0"},
57 + {:ex_machina, "~> 2.8.0"},
58 58 {:ex_unit_notifier, "~> 1.2", only: :test},
59 59 {:faker, "~> 0.17", only: [:dev, :test]},
60 60 {:gradient, github: "esl/gradient", only: [:dev], runtime: false},
61 - {:git_hooks, "~> 0.7.0", only: [:dev], runtime: false},
61 + {:git_hooks, "~> 0.8.1", only: [:dev], runtime: false},
62 62 {:math, "~> 0.7.0"},
63 63 {:mix_audit, "~> 2.0", only: [:dev, :test], runtime: false},
64 64 {:mix_test_watch, "~> 1.0", only: [:dev, :test], runtime: false},