Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ Calendar examples.

## Trouble shooting

Problem: an error like this occours:
Problem: an error like this occurs:

```
** (exit) an exception was raised:
Expand Down
2 changes: 1 addition & 1 deletion lib/calendar/date.ex
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ defimpl Calendar.ContainsDate, for: Calendar.NaiveDateTime do
end
defimpl Calendar.ContainsDate, for: Tuple do
def date_struct({y, m, d}) when y > 23, do: Calendar.Date.from_erl!({y, m, d})
def date_struct({y, _m, _d}) when y <= 23, do: raise "date_struct/1 was called. ContainsDate protocol is not supported for 3-element-tuples where the year is 23 or less. This is to avoid accidently trying to use a time tuple as a date. If you want to work with a date from the year 23 or earlier, consider using a Calendar.Date struct instead."
def date_struct({y, _m, _d}) when y <= 23, do: raise "date_struct/1 was called. ContainsDate protocol is not supported for 3-element-tuples where the year is 23 or less. This is to avoid accidentally trying to use a time tuple as a date. If you want to work with a date from the year 23 or earlier, consider using a Calendar.Date struct instead."
def date_struct({{y, m, d}, {_hour, _min, _sec}}), do: Calendar.Date.from_erl!({y, m, d})
def date_struct({{y, m, d}, {_hour, _min, _sec, _usec}}), do: Calendar.Date.from_erl!({y, m, d})
end
Expand Down
10 changes: 5 additions & 5 deletions lib/calendar/date_time.ex
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ defmodule Calendar.DateTime do
end

# When we have a list of 2 periods, return the one where UTC offset
# and standard offset matches. The is used for instance during ambigous
# and standard offset matches. The is used for instance during ambiguous
# wall time in the fall when switching back from summer time to standard
# time.
# If there is just one period, just return the only period in the list
Expand Down Expand Up @@ -485,7 +485,7 @@ defmodule Calendar.DateTime do
end

@doc """
Takes an erlang style 3 touple timestamp with the form:
Takes an erlang style 3 tuple timestamp with the form:
{megasecs, secs, microsecs}

This is the form returned by the Erlang function `:erlang.timestamp()`
Expand Down Expand Up @@ -520,7 +520,7 @@ defmodule Calendar.DateTime do
Takes an Erlang-style date-time tuple and additionally a timezone name.
Returns a tuple with a tag and a DateTime struct.

The tag can be :ok, :ambiguous or :error. :ok is for an unambigous time.
The tag can be :ok, :ambiguous or :error. :ok is for an unambiguous time.
:ambiguous is for a time that could have different UTC offsets and/or
standard offsets. Usually when switching from summer to winter time.

Expand All @@ -537,7 +537,7 @@ defmodule Calendar.DateTime do
zone_abbr: "-03",
utc_offset: -10800, std_offset: 0, microsecond: {0, 0}} }

Switching from summer to wintertime in the fall means an ambigous time.
Switching from summer to wintertime in the fall means an ambiguous time.

iex> from_erl({{2014, 3, 9}, {1, 1, 1}}, "America/Montevideo")
{:ambiguous, %Calendar.AmbiguousDateTime{possible_date_times:
Expand Down Expand Up @@ -613,7 +613,7 @@ defmodule Calendar.DateTime do
minute: min, second: sec, time_zone: timezone, zone_abbr: period.zone_abbr,
utc_offset: period.utc_off, std_offset: period.std_off, microsecond: microsecond } }
end
# When a time is ambigous (for instance switching from summer- to winter-time)
# When a time is ambiguous (for instance switching from summer- to winter-time)
defp from_erl_periods({{year, month, day}, {hour, min, sec}}, timezone, periods, microsecond) when length(periods) == 2 do
possible_date_times =
Enum.map(periods, fn period ->
Expand Down
4 changes: 2 additions & 2 deletions lib/calendar/date_time/format.ex
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ defmodule Calendar.DateTime.Format do
The decimal_count integer defines the number fractional second digits.
The decimal_count must be between 0 and 6.

Fractional seconds are not rounded up, but rather trucated.
Fractional seconds are not rounded up, but rather truncated.

## Examples

Expand Down Expand Up @@ -287,7 +287,7 @@ defmodule Calendar.DateTime.Format do
"TZID=America/New_York:19980119T020000"
"""
def rfc5545(%DateTime{} = datetime) do
# Convert datetime to NaiveDateTime for compatability with Elixir 1.3's NaiveDateTime.to_iso8601
# Convert datetime to NaiveDateTime for compatibility with Elixir 1.3's NaiveDateTime.to_iso8601
naive_datetime_string =
datetime
|> Calendar.DateTime.to_naive()
Expand Down
2 changes: 1 addition & 1 deletion lib/calendar/date_time/parse.ex
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ defmodule Calendar.DateTime.Parse do
iex> rfc3339_utc("1996-12-19T16:39:57-08:00")
{:ok, %DateTime{year: 1996, month: 12, day: 20, hour: 0, minute: 39, second: 57, time_zone: "Etc/UTC", zone_abbr: "UTC", std_offset: 0, utc_offset: 0}}

# No seperation chars between numbers. Not RFC3339, but we still parse it.
# No separation chars between numbers. Not RFC3339, but we still parse it.
iex> rfc3339_utc("19961219T163957-08:00")
{:ok, %DateTime{year: 1996, month: 12, day: 20, hour: 0, minute: 39, second: 57, time_zone: "Etc/UTC", zone_abbr: "UTC", std_offset: 0, utc_offset: 0}}

Expand Down
2 changes: 1 addition & 1 deletion test/date_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule DateTest do
assert to_erl(%SomethingThatContainsDate{}) == {2015, 1, 1}
end

test "Using a tuple as an argument to a function that expects an argument implenting Calendar.ContainsDate" do
test "Using a tuple as an argument to a function that expects an argument implementing Calendar.ContainsDate" do
assert to_erl({2015, 1, 1}) == {2015, 1, 1}
end

Expand Down