@fineanmol/holiday-optimizer 1.0.0 → 1.0.2
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 +7 -5
- package/package.json +4 -1
- package/vacation_optimizer.js +0 -10
package/README.md
CHANGED
|
@@ -18,6 +18,8 @@ const result = optimize(params);
|
|
|
18
18
|
console.log(formatReport(result, params));
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
**Related:** [`@fineanmol/public-holidays`](https://www.npmjs.com/package/@fineanmol/public-holidays) — standalone holiday lookups (`isHoliday`, `nextHoliday`, etc.) with the same regional data, usable on its own without the optimizer.
|
|
22
|
+
|
|
21
23
|
## What It Does
|
|
22
24
|
|
|
23
25
|
This tool helps you plan your vacations optimally. Given:
|
|
@@ -30,11 +32,11 @@ It finds the best schedule that maximizes your total days off by leveraging week
|
|
|
30
32
|
|
|
31
33
|
## Features
|
|
32
34
|
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
35
|
+
- Dynamic programming to find the best possible schedule (not greedy, actually optimal)
|
|
36
|
+
- Germany and India holiday presets out of the box, easy to add more
|
|
37
|
+
- Control over min/max break length and minimum spacing between breaks
|
|
38
|
+
- Detailed output showing every date and how many total days off you get
|
|
39
|
+
- Runs fully in the browser — no server needed
|
|
38
40
|
|
|
39
41
|
## How It Works
|
|
40
42
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fineanmol/holiday-optimizer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Optimize vacation days using dynamic programming — maximize time off around weekends and public holidays.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
"homepage": "https://github.com/fineanmol/holiday-optimizer#readme",
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@fineanmol/public-holidays": "^1.0.1"
|
|
38
41
|
}
|
|
39
42
|
}
|
package/vacation_optimizer.js
CHANGED
|
@@ -78,12 +78,6 @@ function addDays(d, n) {
|
|
|
78
78
|
return copy;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
function compareISO(a, b) {
|
|
82
|
-
if (a < b) return -1;
|
|
83
|
-
if (a > b) return 1;
|
|
84
|
-
return 0;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
81
|
function isFixedOff(day) {
|
|
88
82
|
return day.is_weekend || day.is_public_holiday || day.is_company_day;
|
|
89
83
|
}
|
|
@@ -408,10 +402,6 @@ function formatReport(res, params) {
|
|
|
408
402
|
`Weekends ${br.weekends} | Public ${br.public_holidays}${companyPart}`
|
|
409
403
|
);
|
|
410
404
|
|
|
411
|
-
const ptoDates = br.days.filter((d) => d.is_pto).map((d) => d.date);
|
|
412
|
-
// if (ptoDates.length) {
|
|
413
|
-
// lines.push(` • Paid leave dates: ${ptoDates.join(", ")}`);
|
|
414
|
-
// }
|
|
415
405
|
lines.push("");
|
|
416
406
|
});
|
|
417
407
|
}
|