time-ago-dk 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +36 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,9 +1,45 @@
1
1
  # time-ago-dk
2
2
 
3
+ [![npm version](https://badge.fury.io/js/time-ago-dk.svg)](https://badge.fury.io/js/time-ago-dk)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
3
6
  A tiny JavaScript utility to convert dates into human readable "time ago" format.
4
7
 
8
+ ## Features
9
+
10
+ - Lightweight and fast
11
+ - Supports years, months, days, hours, minutes, and seconds
12
+ - Returns "just now" for very recent times
13
+ - ES module compatible
14
+
5
15
  ## Installation
6
16
 
7
17
  ```bash
8
18
  npm install time-ago-dk
9
19
  ```
20
+
21
+ ## Usage
22
+
23
+ ```javascript
24
+ import { timeAgo } from "time-ago-dk";
25
+
26
+ console.log(timeAgo(new Date(Date.now() - 60000))); // "1 minute ago"
27
+ console.log(timeAgo(new Date(Date.now() - 3600000))); // "1 hour ago"
28
+ console.log(timeAgo(new Date(Date.now() - 1000))); // "just now"
29
+ ```
30
+
31
+ ## API
32
+
33
+ ### `timeAgo(inputDate)`
34
+
35
+ - **Parameters:**
36
+ - `inputDate` (Date | string | number): The date to convert. Can be a Date object, ISO string, or timestamp.
37
+ - **Returns:** `string` - The human-readable time ago string.
38
+
39
+ ## Contributing
40
+
41
+ Contributions are welcome! Please open an issue or submit a pull request.
42
+
43
+ ## License
44
+
45
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "time-ago-dk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A tiny JavaScript utility to convert dates into human readable 'time ago' format.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",