Show HN: A 1KB zero-dependency relative time formatter for UI systems(appents.com)1 ポイント·投稿者 hedayet·3 か月前·0 コメントappents.comShow HN: A 1KB zero-dependency relative time formatter for UI systemshttps://appents.com/tech/human-time```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"```0 コメントコメントを投稿—
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"
```