In a Phoenix/LiveView application, it’s a bit of a challenge to display the current time to the user in the user’s time zone. There are two primary reasons for this:

  1. Elixir code runs server-side rather than client-side, so the current time in our app’s Elixir code is the time on the server where our app is running.
  2. By default, Elixir can only handle the Coordinated Universal Time (UTC) time zone.

However, with a time zone library and a little JavaScript, we can solve both problems.

Let’s start by making a Phoenix application with a LiveView implementation of a clock.

continue reading on dockyard.com

⚠️ This post links to an external website. ⚠️