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.
- package/README.md +36 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,45 @@
|
|
|
1
1
|
# time-ago-dk
|
|
2
2
|
|
|
3
|
+
[](https://badge.fury.io/js/time-ago-dk)
|
|
4
|
+
[](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.
|