Human-friendly relative time formatter for JavaScript and Node.js. Convert timestamps into readable phrases like just now, 5m ago, or yesterday.
npm install human-time-2026!npm
!downloads
!stars
!issues
!license
!views
Human-friendly time formatting for modern JavaScript.
Turn boring timestamps into natural, readable phrases like βjust nowβ, βthis morningβ, β3d agoβ, or βin 5mβ β instantly.
Built for 2026 projects, minimal, fast, and dependency-free.
---
Most time libraries are heavy or overkill.
human-time-2026 focuses on what humans actually say.
β Ultra-lightweight
β Zero dependencies
β Past & future support
β Smart context detection
β Works everywhere (Node, Bun, Deno, Browser)
---
``bash``
npm install human-time-2026
---
`js
import humanTime from 'human-time-2026';
// --- Contextual Awareness ---
// If it's currently 10:00 AM...
console.log(humanTime(new Date().setHours(8, 0)));
// Output: "this morning"
// If it's 3:00 AM...
console.log(humanTime(new Date().setHours(2, 0)));
// Output: "late last night"
// --- Standard Relative Time ---
console.log(humanTime(Date.now() - 5000)); // "just now"
console.log(humanTime(Date.now() - 120000)); // "2m ago"
// --- Future Dates ---
console.log(humanTime(Date.now() + 86400000)); // "tomorrow"
`
---
| Input Time | Output |
| ---------------- | -------------- |
| 2 seconds ago | just now |45s ago
| 45 seconds ago | |5m ago
| 5 minutes ago | |this morning
| Same day morning | |yesterday
| Yesterday | |3 days ago
| 3 days ago | |2w ago
| 2 weeks ago | |2025
| Last year | |
---
* Automatically detects past or future
* Uses natural language, not robotic strings
* Smart day-based context:
* morning / afternoon / evening
* yesterday / tomorrow
* Falls back to month/day or year when needed
No configs. No setup. Just import & use.
---
* Chat apps
* Social media feeds
* Logs & dashboards
* Notifications
* WhatsApp / Telegram bots
* Any UI that shows time to humans
---
If this package saved you time or made your UI better:
π Give it a β on GitHub
Stars help this project reach more developers β€οΈ
---
Want to improve human-time-2026`?
* π Found a bug? β Create an Issue
* β¨ Have an idea? β Open an Issue
* π§ Want to fix something? β Fork & Pull Request
* π New feature? β PRs are welcome
Please contribute only through the official repository.
---
MIT License Β© 2026
Abhishek Suresh
https://github.com/AbhishekSuresh2
> β οΈ Please do not copy, modify, or republish this package as your own without explicit permission.
---
Make time feel human, not mechanical.
Let machines adapt to people β not the other way around.
human-time-2026 β³β¨