glintl

Format dates and times in many languages, on Erlang and JavaScript.

Glintl lazy-loads locales for performance. On Erlang it aims to have the same output as JavaScript’s Intl.DateTimeFormat.

gleam add glintl gleam_time
import gleam/time/duration
import gleam/time/timestamp
import glintl
import glintl/locale/en_gb
import glintl/locale/fr

pub fn main() {
  let now = timestamp.system_time()
  let offset = duration.hours(1)

  glintl.date_time_formatter(en_gb.locale(), date: glintl.Long, time: glintl.Short)
  |> glintl.format(now, offset:)
  // -> "25 October 2026 at 23:40"

  glintl.date_formatter(fr.locale(), style: glintl.Full)
  |> glintl.format(now, offset:)
  // -> "dimanche 25 octobre 2026"
}

It is recommended to reuse formatters for performance, because making one is expensive and does lookup work.

Styles

StyleDateTime
FullSunday, 25 October 202623:40:58 GMT+01:00
Long25 October 202623:40:58 GMT+1
Medium25 Oct 202623:40:58
Short25/10/202623:40

Locales

Calendars

How it works

On Erlang:

On JavaScript:

Limits

Known differences

Contributing

bun install --cwd codegen
bun fmt --cwd codegen && bun lint --cwd codegen && bun check --cwd codegen
gleam test --target erlang
gleam test --target javascript
gleam run -m glintl_bench
bun codegen/conformance.ts 1000000
docker run --rm -v "$PWD":/repo -w /repo oven/bun:$(cat .bun-version) bun codegen/generate.ts
gleam format src test
✨ Search Document