Skip to content

Commit ae8262a

Browse files
lauJosé Valim
authored andcommitted
Add more Time.compare/2 examples
Showing :eq and a an example of dates not having any effect.
1 parent 64cd202 commit ae8262a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/elixir/lib/calendar/time.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,16 @@ defmodule Time do
331331
332332
iex> Time.compare(~T[16:04:16], ~T[16:04:28])
333333
:lt
334+
iex> Time.compare(~T[16:04:16], ~T[16:04:16])
335+
:eq
334336
iex> Time.compare(~T[16:04:16.01], ~T[16:04:16.001])
335337
:gt
336338
337339
This function can also be used to compare across more
338340
complex calendar types by considering only the time fields:
339341
342+
iex> Time.compare(~N[1900-01-01 16:04:16], ~N[2015-01-01 16:04:16])
343+
:eq
340344
iex> Time.compare(~N[2015-01-01 16:04:16], ~N[2015-01-01 16:04:28])
341345
:lt
342346
iex> Time.compare(~N[2015-01-01 16:04:16.01], ~N[2000-01-01 16:04:16.001])

0 commit comments

Comments
 (0)