Skip to content

Commit 9a8e08e

Browse files
committed
Mix format
1 parent 1438536 commit 9a8e08e

File tree

13 files changed

+92
-49
lines changed

13 files changed

+92
-49
lines changed

lib/cldr/calendar.ex

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,14 @@ defmodule Cldr.Calendar do
292292
in this implementation.
293293
"""
294294
@callback cldr_calendar_type() ::
295-
:gregorian | :persian | :coptic | :ethiopic |
296-
:ethiopic_amete_alem | :chinese | :japanese | :dangi
295+
:gregorian
296+
| :persian
297+
| :coptic
298+
| :ethiopic
299+
| :ethiopic_amete_alem
300+
| :chinese
301+
| :japanese
302+
| :dangi
297303

298304
@doc """
299305
Returns the calendar basis.
@@ -824,7 +830,7 @@ defmodule Cldr.Calendar do
824830
"""
825831
@doc since: "2.4.0"
826832
@spec convert(Date.t() | Date.Range.t(), Calendar.calendar()) ::
827-
{:ok, Date.t() | Date.Range.t()} | {:error, :incompatible_calendars}
833+
{:ok, Date.t() | Date.Range.t()} | {:error, :incompatible_calendars}
828834

829835
def convert(%Date{} = date, calendar) do
830836
Date.convert(date, calendar)
@@ -837,7 +843,6 @@ defmodule Cldr.Calendar do
837843
end
838844
end
839845

840-
841846
@doc """
842847
Formats the given date, time, or datetime into a string.
843848
@@ -856,7 +861,7 @@ defmodule Cldr.Calendar do
856861
"""
857862
def strftime(date_or_time_or_datetime, format, options \\ []) do
858863
calendar = Map.get(date_or_time_or_datetime, :calendar)
859-
options = Keyword.merge(options, [calendar: calendar])
864+
options = Keyword.merge(options, calendar: calendar)
860865
strftime_options = strftime_options!(options)
861866

862867
Calendar.strftime(date_or_time_or_datetime, format, strftime_options)
@@ -3015,7 +3020,7 @@ defmodule Cldr.Calendar do
30153020
@doc since: "2.3.0"
30163021

30173022
@spec month_names(calendar :: calendar(), options :: Keyword.t()) ::
3018-
list({pos_integer, String.t()}) | {:error, {module(), String.t()}}
3023+
list({pos_integer, String.t()}) | {:error, {module(), String.t()}}
30193024

30203025
def month_names(calendar, options \\ [])
30213026

lib/cldr/calendar/backend/calendar.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ defmodule Cldr.Calendar.Backend do
344344
{:ok, calendar} <- Cldr.Calendar.validate_calendar(calendar) do
345345
cldr_calendar = calendar.cldr_calendar_type()
346346
calendar_config = calendar.__config__()
347+
347348
am_pm_default_or_variant =
348349
if options[:am_pm] == :variant, do: :variant, else: :default
349350

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
defmodule Cldr.Calendar.Julian.Dec25 do
22
use Cldr.Calendar.Julian, new_year_starting_month_and_day: {12, 25}
3-
4-
end
3+
end
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
defmodule Cldr.Calendar.Julian.Jan1 do
22
use Cldr.Calendar.Julian, new_year_starting_month_and_day: {1, 1}
3-
4-
end
3+
end
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
defmodule Cldr.Calendar.Julian.March1 do
22
use Cldr.Calendar.Julian, new_year_starting_month_and_day: {3, 1}
3-
4-
end
3+
end
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
defmodule Cldr.Calendar.Julian.March25 do
22
use Cldr.Calendar.Julian, new_year_starting_month_and_day: {3, 25}
3-
4-
end
3+
end
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
defmodule Cldr.Calendar.Julian.Sept1 do
22
use Cldr.Calendar.Julian, new_year_starting_month_and_day: {9, 1}
3-
4-
end
3+
end

lib/cldr/calendar/calendars/julian_compiler.ex

Lines changed: 60 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ defmodule Cldr.Calendar.Julian.Compiler do
2626
2727
"""
2828
defguard year_rollover(month, day)
29-
when month < @new_year_starting_month
30-
or (month == @new_year_starting_month and day < @new_year_starting_day)
29+
when month < @new_year_starting_month or
30+
(month == @new_year_starting_month and day < @new_year_starting_day)
3131

3232
# Adjust the year to be a Jan 1st starting year and carry
3333
# on
@@ -138,8 +138,10 @@ defmodule Cldr.Calendar.Julian.Compiler do
138138
adjusted_month == @last_month_of_year ->
139139
start_of_month =
140140
date_to_iso_days(year, adjusted_month, 1)
141+
141142
start_of_next_month =
142143
date_to_iso_days(year + 1, @new_year_starting_month, @new_year_starting_day)
144+
143145
start_of_next_month - start_of_month
144146

145147
true ->
@@ -154,7 +156,7 @@ defmodule Cldr.Calendar.Julian.Compiler do
154156
{year, month, day} = last_day_of_year(year)
155157
{:ok, last_date} = Date.new(year, month, day, __MODULE__)
156158

157-
Date.range(first_date, last_date, 1)
159+
Date.range(first_date, last_date)
158160
end
159161

160162
def quarter(year, quarter) do
@@ -169,14 +171,14 @@ defmodule Cldr.Calendar.Julian.Compiler do
169171
if adjusted_month == @new_year_starting_month, do: @new_year_starting_day, else: 1
170172

171173
{:ok, first} = Date.new(year, adjusted_month, first_day, __MODULE__)
174+
172175
first_iso_days = date_to_iso_days(year, adjusted_month, first_day)
173176
days_in_month = days_in_month(year, ordinal_month)
174-
175177
last_iso_days = first_iso_days + days_in_month - 1
176178
{year, month, day} = date_from_iso_days(last_iso_days)
177179
{:ok, last} = Date.new(year, month, day, __MODULE__)
178180

179-
Date.range(first, last, 1)
181+
Date.range(first, last)
180182
end
181183

182184
def quarter_of_year(year, month, day) do
@@ -226,7 +228,7 @@ defmodule Cldr.Calendar.Julian.Compiler do
226228
end
227229

228230
def last_day_of_year(year) do
229-
last_day = first_iso_day_of_year(year + 1) - 1
231+
last_day = first_iso_day_of_year(year + 1) - 1
230232
date_from_iso_days(last_day)
231233
end
232234

@@ -241,7 +243,7 @@ defmodule Cldr.Calendar.Julian.Compiler do
241243
end
242244

243245
def leap_year?(year) do
244-
last_iso_day_of_year(year) - first_iso_day_of_year(year) + 1 == 366
246+
last_iso_day_of_year(year) - first_iso_day_of_year(year) + 1 == 366
245247
end
246248

247249
defdelegate valid_date?(year, month, day), to: Cldr.Calendar.Julian
@@ -261,26 +263,67 @@ defmodule Cldr.Calendar.Julian.Compiler do
261263
defdelegate week_of_month(year, month, day), to: Cldr.Calendar.Julian
262264
defdelegate valid_time?(hour, minute, second, millisecond), to: Cldr.Calendar.Julian
263265
defdelegate time_to_string(hour, minute, second, millisecond), to: Cldr.Calendar.Julian
264-
defdelegate time_to_day_fraction(hour, minute, second, millisecond), to: Cldr.Calendar.Julian
266+
267+
defdelegate time_to_day_fraction(hour, minute, second, millisecond),
268+
to: Cldr.Calendar.Julian
269+
265270
defdelegate time_from_day_fraction(fraction), to: Cldr.Calendar.Julian
266-
defdelegate shift_time(hour, minute, second, millisecond, duration), to: Cldr.Calendar.Julian
267-
defdelegate shift_naive_datetime(year, month, day, hour, minute, second, millisecond, duration), to: Cldr.Calendar.Julian
271+
272+
defdelegate shift_time(hour, minute, second, millisecond, duration),
273+
to: Cldr.Calendar.Julian
274+
275+
defdelegate shift_naive_datetime(
276+
year,
277+
month,
278+
day,
279+
hour,
280+
minute,
281+
second,
282+
millisecond,
283+
duration
284+
),
285+
to: Cldr.Calendar.Julian
286+
268287
defdelegate iso_days_to_end_of_day(iso_days), to: Cldr.Calendar.Julian
269288
defdelegate iso_days_to_beginning_of_day(iso_days), to: Cldr.Calendar.Julian
270289
defdelegate parse_utc_datetime(string), to: Cldr.Calendar.Julian
271290
defdelegate parse_time(string), to: Cldr.Calendar.Julian
272291
defdelegate parse_naive_datetime(string), to: Cldr.Calendar.Julian
273292
defdelegate day_rollover_relative_to_midnight_utc, to: Cldr.Calendar.Julian
274293

275-
defdelegate datetime_to_string(year, month, day, hour, minute, second, microsecond, time_zone, zone_abbr, utc_offset, std_offset),
276-
to: Cldr.Calendar.Julian
277-
278-
defdelegate datetime_to_string(year, month, day, hour, minute, second, microsecond, time_zone, zone_abbr, utc_offset, std_offset, format),
279-
to: Cldr.Calendar.Julian
294+
defdelegate datetime_to_string(
295+
year,
296+
month,
297+
day,
298+
hour,
299+
minute,
300+
second,
301+
microsecond,
302+
time_zone,
303+
zone_abbr,
304+
utc_offset,
305+
std_offset
306+
),
307+
to: Cldr.Calendar.Julian
308+
309+
defdelegate datetime_to_string(
310+
year,
311+
month,
312+
day,
313+
hour,
314+
minute,
315+
second,
316+
microsecond,
317+
time_zone,
318+
zone_abbr,
319+
utc_offset,
320+
std_offset,
321+
format
322+
),
323+
to: Cldr.Calendar.Julian
280324

281325
defdelegate naive_datetime_to_string(year, month, day, hour, minute, second, microsecond),
282326
to: Cldr.Calendar.Julian
283-
284327
end
285328
end
286-
end
329+
end

mix.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ defmodule Cldr.Calendar.MixProject do
7171
{:ex_cldr_numbers, "~> 2.34"},
7272
{:ex_cldr_units, "~> 3.18", optional: true},
7373
{:ex_cldr_lists, "~> 2.10", optional: true},
74-
7574
{:tz, "~> 0.9", optional: true, only: [:dev, :test]},
7675
{:calendar_interval, "~> 0.2", optional: true},
7776
{:jason, "~> 1.0"},

mix/territory/il.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ require Cldr.Calendar.Compiler.Month
22

33
defmodule Cldr.Calendar.IL do
44
use Cldr.Calendar.Base.Month, day_of_week: 7
5-
end
5+
end

0 commit comments

Comments
 (0)