Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elixir Date.diff/2 is undefined or private

Tags:

elixir

I am new to Elixir and trying to run some scripts from elixir documentation, testing Date structure gave a strange result because Date.compare(~D[2016-04-16], ~D[2016-04-28]) is returning :lt while when trying to run Date.diff(~D[2016-04-16], ~D[2016-04-28]) I am getting this error

(UndefinedFunctionError) function Date.diff/2 is undefined or private
(elixir) Date.diff(~D[2016-04-16], ~D[2016-04-28])
like image 986
user2923970 Avatar asked Jan 24 '26 15:01

user2923970


1 Answers

Date.diff/2 was added in Elixir 1.5 (as you can see here). I am pretty sure you are using previous version. By running elixir -v you can check what version you have currently installed.

like image 80
Haito Avatar answered Jan 27 '26 07:01

Haito



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!