-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Given the following test for timestamps_test.exs
test "filtering datetimes" do
# iso8601 type
time = ~U[2023-04-20 17:00:25Z]
account =
%Account{}
|> Account.changeset(%{name: "Test"})
|> TestRepo.insert!()
%Product{}
|> Product.changeset(%{
account_id: account.id,
name: "Qux1",
approved_at: time
})
|> TestRepo.insert!()
from(
u in Product,
where: u.approved_at == ^time
)
|> TestRepo.exists?()
|> IO.inspect()
from(
u in Product,
where: fragment("? = ?", u.approved_at, ^time)
)
|> TestRepo.exists?()
|> IO.inspect()
from(
u in Product,
where: fragment("? = ?", u.approved_at, ^DateTime.to_unix(time, :millisecond))
)
|> TestRepo.exists?()
|> IO.inspect()
endAll 3 cases will print false for me.
Is this expected and if so why?
Metadata
Metadata
Assignees
Labels
No labels