Back to browse
A 1KB zero-dependency relative time formatter for UI systems

A 1KB zero-dependency relative time formatter for UI systems

by hedayet·Apr 10, 2026·1 point·0 comments

AI Analysis

MidCozySlick

Yet another time formatter when date-fns and dayjs already do this.

Strengths
  • 1KB bundle size is genuinely tiny for a utility library
  • Zero dependencies means no supply chain risk or bloat
  • Clean dual API with short and long format options
Weaknesses
  • Relative time formatting is solved by date-fns, dayjs, luxon
  • No clear differentiation beyond bundle size
Target Audience

Frontend developers building UIs with timestamps

Similar To

date-fns · dayjs · moment.js

Post Description

```

import { formatRelative } from '@appents/human-time';

const past = new Date(Date.now() - 5 * 60_000); formatRelative(past); // "5m ago"

const future = new Date(Date.now() + 3 * 3_600_000); formatRelative(future); // "In 3h"

```

And

```

import { formatRelativeLong } from '@appents/human-time';

const past = new Date(Date.now() - 5 * 60_000); formatRelativeLong(past); // "5 minutes ago"

```

Similar Projects