Skip to content

v4.1 • Utils • 3kb gzipped • MIT

DateSlim

Date formatting and relative time that leans on the platform instead of shipping a locale database.

★ 7.4kGitHub
↓ 13.9k / week● MIT● TS 5.0+
dateslim-preview.png
Abstract preview graphic for DateSlim

// why dateslim

The platform already knows

Built on Intl, so every locale the browser supports works without adding a byte to your bundle.

● 0 deps● 3kb gzipped● tree-shakeable

// stack

Immutable operations

Every function returns a new value. No accidental mutation of a date held somewhere else.

DateSlim started as a single file in a client project and stayed small on purpose. It does one job, it does it in 3kb gzipped, and it has no runtime dependencies.

Getting started

Install it, import it, call it:

npm i dateslim-js

Built on Intl, so every locale the browser supports works without adding a byte to your bundle.

What it does not do

It does not manage your state, style your components or ship a plugin system. Those are your decisions, and keeping them out is what keeps the bundle honest.

  • Every locale, no data files
  • Relative time that reads well
  • MIT licensed, commercially friendly

Features

Every locale, no data files

Formatting comes from Intl, so locale coverage costs nothing.

Relative time that reads well

Chooses the unit a person would choose, not the one the arithmetic suggests.

Documented properly

Every public function has a worked example, not just a signature.

ESM and types

Ships module and CommonJS builds with hand-written type definitions and source maps.

Tree-shakes cleanly

Every export is side-effect free, so importing one function costs one function.

Tested to the edges

Ninety-eight percent branch coverage, with the awkward cases written first.

Get DateSlim v4.1

12 files • .min.js 3kb • .zip 84kb • sha384 verified

Changelog

v4.1 Mar 7 2026 • latest
  • Duration formatting via Intl
  • Relative unit selection reworked
  • Tree-shakes to 900 bytes
v4.0.1 Jan 6 2026
  • Reworked the public API for consistency
  • Deprecated helpers removed
v4.0 Oct 29 2025
  • Fixed a memory leak on repeated teardown
  • Source maps now published with every build
View full archive →

// related

Related products

Aug 19 • v1.9.4

FormFlow

Validation and multi-step logic that works the same in React, Vue and vanilla. Your markup stays yours.

View →
Jul 17 • v1.2

AuthKit

Drop-in JWT, OAuth and magic links with secure defaults and a five-minute setup.

View →
May 01 • v1.3

PrintCanvas

Export any canvas to print-ready PNG, SVG or PDF at whatever resolution the page needs.

View →

Drop it in this afternoon.

MIT licensed. Commercial friendly. Five-minute setup.