Skip to content
Merged
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 lib/http_cookie.ex
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ defmodule HttpCookie do
@spec expired?(cookie :: t()) :: boolean()
@spec expired?(cookie :: t(), now :: DateTime.t()) :: boolean()
def expired?(cookie, now \\ DateTime.utc_now()) do
DateTime.after?(now, cookie.expiry_time)
DateTime.compare(now, cookie.expiry_time) == :gt
end

# 5.4. The Cookie Header
Expand Down
2 changes: 1 addition & 1 deletion lib/http_cookie/jar.ex
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ defmodule HttpCookie.Jar do
rhs_path_size = byte_size(rhs_cookie.path)

if lhs_path_size == rhs_path_size do
DateTime.before?(lhs_cookie.creation_time, rhs_cookie.creation_time)
DateTime.compare(lhs_cookie.creation_time, rhs_cookie.creation_time) == :lt
else
lhs_path_size > rhs_path_size
end
Expand Down
4 changes: 2 additions & 2 deletions lib/http_cookie/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ defmodule HttpCookie.Parser do
case DateParser.parse(val) do
{:ok, dt} ->
cond do
DateTime.after?(dt, latest_expiry_time()) ->
DateTime.compare(dt, latest_expiry_time()) == :gt ->
{"Expires", latest_expiry_time()}

DateTime.before?(dt, earliest_expiry_time()) ->
DateTime.compare(dt, earliest_expiry_time()) == :lt ->
{"Expires", earliest_expiry_time()}

true ->
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule HttpCookie.MixProject do
[
app: :http_cookie,
version: @version,
elixir: "~> 1.15",
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
description: description(),
package: package(),
Expand Down
2 changes: 1 addition & 1 deletion test/http_cookie/jar_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ defmodule HttpCookie.JarTest do
|> Map.values()
|> hd()

assert DateTime.after?(updated_cookie.last_access_time, ~U[2024-04-01 12:00:00Z])
assert DateTime.compare(updated_cookie.last_access_time, ~U[2024-04-01 12:00:00Z]) == :gt
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/http_cookie/req_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ defmodule HttpCookie.ReqTest do
|> Map.fetch!({"foo", "/"})
|> Map.fetch!(:last_access_time)

assert DateTime.after?(updated_access_time, original_access_time)
assert DateTime.compare(updated_access_time, original_access_time) == :gt
end

test "picks up cookies from redirect response" do
Expand Down