How to use Tzdata in elixir script?

I’d like to make sample data and some test which uses DateTime with timezone.

I don’t know how to import Tzdata module into elixir script, like seeds.exs or test script.
Now I got a below message

** (UndefinedFunctionError)
 function Tzdata.TimeZoneDatabase.time_zone_periods_from_wall_datetime/2
is undefined (module Tzdata.TimeZoneDatabase is not available)

Could you tell me how to achieve it?

Thanks.

If you have it directly or indirectly in your deps, it should be available when you do mix test or mix run.

Can you provide a minimal example project that shows your problem?

@NobbZ thanks for your replay.

Your comment helped me.
I found my mistake. I wrote tzdata in “umbrella project” deps. Now I move it to apps deps and it works.

Thank you!!

1 Like