Skip to content

Commit 6f63ca3

Browse files
committed
add docs
1 parent 75ed764 commit 6f63ca3

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

lib/elixir/lib/calendar/iso.ex

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,18 @@ defmodule Calendar.ISO do
12301230
|> IO.iodata_to_binary()
12311231
end
12321232

1233+
@doc """
1234+
Converts the given time into a iodata.
1235+
1236+
Loog at time_to_string/5 for more information
1237+
1238+
## Examples
1239+
1240+
iex> Calendar.ISO.time_to_iodata(2, 2, 2, {2, 6})
1241+
[[["0", "2"], 58, ["0", "2"], 58, ["0", "2"]], 46, ["00000", "2"]]
1242+
1243+
"""
1244+
@doc since: "1.19.0"
12331245
def time_to_iodata(
12341246
hour,
12351247
minute,
@@ -1306,6 +1318,17 @@ defmodule Calendar.ISO do
13061318
|> IO.iodata_to_binary()
13071319
end
13081320

1321+
@doc """
1322+
Converts the given date into a iodata.
1323+
Look at date_to_string/4 for more information
1324+
1325+
## Examples
1326+
1327+
iex> Calendar.ISO.date_to_iodata(2015, 2, 28)
1328+
["2015", 45, ["0", "2"], 45, "28"]
1329+
"""
1330+
@doc since: "1.19.0"
1331+
@spec date_to_iodata(year, month, day, :basic | :extended) :: iodata
13091332
def date_to_iodata(year, month, day, format \\ :extended)
13101333
when is_integer(year) and is_integer(month) and is_integer(day) and
13111334
format in [:basic, :extended] do
@@ -1373,6 +1396,17 @@ defmodule Calendar.ISO do
13731396
|> IO.iodata_to_binary()
13741397
end
13751398

1399+
@doc """
1400+
Converts the given naive_datetime into a iodata.
1401+
Look at naive_datetime_to_iodata/8 for more information
1402+
1403+
## Examples
1404+
1405+
iex> Calendar.ISO.naive_datetime_to_iodata(2015, 2, 28, 1, 2, 3, {4, 6}, :basic)
1406+
[["2015", ["0", "2"], "28"], 32, [[["0", "1"], ["0", "2"], ["0", "3"]], 46, ["00000", "4"]]]
1407+
1408+
"""
1409+
@doc since: "1.19.0"
13761410
def naive_datetime_to_iodata(
13771411
year,
13781412
month,
@@ -1471,6 +1505,18 @@ defmodule Calendar.ISO do
14711505
|> IO.iodata_to_binary()
14721506
end
14731507

1508+
@doc """
1509+
Converts the given datetime into a iodata.
1510+
Look at datetime_to_iodata/12 for more information
1511+
1512+
## Examples
1513+
1514+
iex> time_zone = "Etc/UTC"
1515+
iex> Calendar.ISO.datetime_to_iodata(2017, 8, 1, 1, 2, 3, {4, 5}, time_zone, "UTC", 0, 0)
1516+
[["2017", 45, ["0", "8"], 45, ["0", "1"]], 32, [[["0", "1"], 58, ["0", "2"], 58, ["0", "3"]], 46, ["0000", "0"]], 90, []]
1517+
1518+
"""
1519+
@doc since: "1.19.0"
14741520
def datetime_to_iodata(
14751521
year,
14761522
month,
@@ -1504,6 +1550,7 @@ defmodule Calendar.ISO do
15041550
|> IO.iodata_to_binary()
15051551
end
15061552

1553+
@doc false
15071554
def offset_to_iodata(0, 0, "Etc/UTC", _format), do: ?Z
15081555

15091556
def offset_to_iodata(utc, std, _zone, format) do

0 commit comments

Comments
 (0)