mathieuprog / tz_extra

A few utilities to work with time zones in Elixir
Apache License 2.0
18 stars 1 forks source link

Add a way to store and retrieve timezoned dates #4

Open obsidienne opened 2 years ago

obsidienne commented 2 years ago

Hi,

I need to store and retrieve date for upcoming events (start datetime and end datetime).

I will use tz and tzdata for the timezone handling but the datetime storage/retrieve is missing to complete the use case.

Do you have any advice ?

Thanks.

mathieuprog commented 2 years ago

I would advice to store the date times NOT in UTC, but in the time zone of the event. So in the database you would have the datetime and time zone identifier.

But I guess that doesn't really answer your question. I'm not sure what you want me to advice. The store data in DB we use Ecto. You just need to add the date and time zone fields in your db table.

obsidienne commented 2 years ago

A friend just told me about the hex package tz_datetime. This lib adds convenience functions to store and retrieve datetime with timezone.

Could be something interesting to add to your lib.

Thanks for your answer.