# Use Client APIs without Actual Javascript

**URL:** <https://forum.elixirforum.com/t/use-client-apis-without-actual-javascript/72200>\
**Category:** Questions\
**Tags:** javascript, hologram\
**Created:** [August 22, 2025, 11:09am UTC](https://forum.elixirforum.com/t/use-client-apis-without-actual-javascript/72200 "2025-08-22T11:09:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwmiller](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mwmiller/32/38469_2.png) [@mwmiller](https://forum.elixirforum.com/u/mwmiller)\
**Post date:** [August 22, 2025, 11:09am UTC](https://forum.elixirforum.com/t/use-client-apis-without-actual-javascript/72200/1 "2025-08-22T11:09:51Z")

</div>

I’m wondering if there is a way to use some Javascript client APIs via Hologram without writing some kind of pure JS hooks.

I want to add some date information to my pages. A notoriously sticky wicket, to be sure. However my needs are fairly simple. I have UTC instants in my data source. I’d like to display them as local times for user convenience.

I don’t like pushing client concerns to the server or vice-versa. So I’d rather not round trip the client’s TZ to the server to create a date string in Elixir which might not even match their locale’s preferred formatting. Instead, I’d like to push the common-to-all-clients UTC instants to the clients and allow them to format it as desired.

Is this just something for which I will _have_ to write some Javascript? Or is there a clever workaround of which I cannot think?

---

<div class="post-metadata">

**Author:** ![bartblast](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartblast/32/17647_2.png) [@bartblast](https://forum.elixirforum.com/u/bartblast)\
**Post date:** [August 22, 2025, 1:15pm UTC](https://forum.elixirforum.com/t/use-client-apis-without-actual-javascript/72200/2 "2025-08-22T13:15:01Z")

</div>

Web API wrappers are planned, but locale and time handling need a special isomorphic-aware approach. For your use case, you’d probably want to server-render with a default timezone first, then update client-side - otherwise you’d have to render all dates only after client load.

Some `DateTime` timezone functions are impractical to transpile directly because they require timezone database libraries like `tzdata` (Elixir’s default `UTCOnlyTimeZoneDatabase` only supports UTC). These libraries contain large IANA timezone databases that would bloat the JS bundle. Instead, it’s better to port them manually using Web APIs underneath while maintaining the same Elixir API.

You could theoretically get the timezone like this now:

```elixir
timezone = ~JS"return Type.string(Intl.DateTimeFormat().resolvedOptions().timeZone)"

```

This would return something like `"Europe/Warsaw"`, but the `DateTime` functions to format dates with that timezone won’t compile correctly yet for the reasons mentioned above.

Two insights from your use case:

- I need to manually port key `DateTime` functions
- There’s probably a need for client-side system info modules like `Hologram.Client`, `Hologram.Device`, `Hologram.Platform`, etc. (you’d use something like `Hologram.Client.timezone()`)

Is this blocking you at the moment?

---

<div class="post-metadata">

**Author:** ![mwmiller](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mwmiller/32/38469_2.png) [@mwmiller](https://forum.elixirforum.com/u/mwmiller)\
**Post date:** [August 22, 2025, 1:21pm UTC](https://forum.elixirforum.com/t/use-client-apis-without-actual-javascript/72200/3 "2025-08-22T13:21:19Z")

</div>

Thanks for the explanation! This is actually further along than I expected already.

> [@bartblast](#):
>
> Is this blocking you at the moment?

It’s a silly little side project and my explorations of what’s possible. It could not matter less in the grand scheme of things.

---

<div class="post-metadata">

**Author:** ![bartblast](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartblast/32/17647_2.png) [@bartblast](https://forum.elixirforum.com/u/bartblast)\
**Post date:** [August 22, 2025, 1:25pm UTC](https://forum.elixirforum.com/t/use-client-apis-without-actual-javascript/72200/4 "2025-08-22T13:25:35Z")

</div>

I won’t prioritize the DateTime porting immediately then, but I’ll keep it high in the backlog since others will likely hit this pattern too.
