@swaray21/date-utils 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 +80 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -0,0 +1,80 @@
1
+ # Date Utils
2
+
3
+ A lightweight JavaScript package that provides simple date and time utility functions.
4
+
5
+ ## Installation
6
+
7
+ Install the package using npm:
8
+
9
+ ```bash
10
+ npm install @swaray21/date-utils
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Import the functions into your JavaScript project:
16
+
17
+ ```javascript
18
+ const {
19
+ formatDate,
20
+ calculateAge,
21
+ getDaysBetween,
22
+ isWeekend,
23
+ addDays
24
+ } = require("@swaray21/date-utils");
25
+ ```
26
+
27
+ ## Available Functions
28
+
29
+ ### 1. formatDate(date)
30
+
31
+ Formats a date into DD/MM/YYYY.
32
+
33
+ ```javascript
34
+ formatDate("2026-10-31");
35
+ // Output: 31/10/2026
36
+ ```
37
+
38
+ ### 2. calculateAge(dateOfBirth)
39
+
40
+ Calculates a person's age from their date of birth.
41
+
42
+ ```javascript
43
+ calculateAge("2000-01-01");
44
+ ```
45
+
46
+ ### 3. getDaysBetween(startDate, endDate)
47
+
48
+ Calculates the number of days between two dates.
49
+
50
+ ```javascript
51
+ getDaysBetween("2026-10-01", "2026-10-31");
52
+ // Output: 30
53
+ ```
54
+
55
+ ### 4. isWeekend(date)
56
+
57
+ Checks whether a date falls on Saturday or Sunday.
58
+
59
+ ```javascript
60
+ isWeekend("2026-10-31");
61
+ // Output: true
62
+ ```
63
+
64
+ ### 5. addDays(date, days)
65
+
66
+ Adds a specified number of days to a date.
67
+
68
+ ```javascript
69
+ addDays("2026-10-31", 5);
70
+ // Returns a Date object representing November 5, 2026.
71
+ ```
72
+
73
+ ## Requirements
74
+
75
+ - Node.js
76
+ - npm
77
+
78
+ ## License
79
+
80
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swaray21/date-utils",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A lightweight JavaScript date and time utility library",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -21,4 +21,4 @@
21
21
  "README.md",
22
22
  "LICENSE"
23
23
  ]
24
- }
24
+ }