Settings

Theme

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

appents.com

1 points by hedayet 23 days ago · 0 comments · 1 min read

Reader

```

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"

```

No comments yet.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection