I’m want to send emails from my elixir/phoenix application that contains information about events stored in the database. Included in this information is the date and time of the event. The event times are stored in the DB as UTC timestamps. I also have lat/long coordinates of the event location in the DB.
Ideally in the email the event time would be formatted to be displayed in the timezone of the location where the event is being held.
e.g. if an event being held in Paris, France is at 2019-11-20T13:00:00Z this might be displayed in the email as “20 Nov 2019, 14:00 CET”.
Alternatively the time would be displayed in the recipient’s timezone. This is tricky though as I have no control over any client side date parsing etc in an email.
I’m aware of 3rd party APIs that can give a timezone from a lat/long but I’d like to avoid adding such a dependency.
I am also considering attaching an invite.ics to the email so that compatible email clients can parse it and display it in the recipient’s timezone.
Are there any good suggestions for solving this problem? I imagine it must be quite a common challenge.