richie-cron 0.1.0 → 0.1.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/dist/cjs/index.cjs +68 -0
- package/dist/cjs/index.cjs.map +10 -0
- package/dist/cjs/package.json +5 -0
- package/dist/cjs/src/CronDate.cjs +468 -0
- package/dist/cjs/src/CronDate.cjs.map +10 -0
- package/dist/cjs/src/CronExpression.cjs +339 -0
- package/dist/cjs/src/CronExpression.cjs.map +10 -0
- package/dist/cjs/src/CronExpressionParser.cjs +300 -0
- package/dist/cjs/src/CronExpressionParser.cjs.map +10 -0
- package/dist/cjs/src/CronFieldCollection.cjs +249 -0
- package/dist/cjs/src/CronFieldCollection.cjs.map +10 -0
- package/dist/cjs/src/fields/CronDayOfMonth.cjs +62 -0
- package/dist/cjs/src/fields/CronDayOfMonth.cjs.map +10 -0
- package/dist/cjs/src/fields/CronDayOfWeek.cjs +65 -0
- package/dist/cjs/src/fields/CronDayOfWeek.cjs.map +10 -0
- package/dist/cjs/src/fields/CronField.cjs +151 -0
- package/dist/cjs/src/fields/CronField.cjs.map +10 -0
- package/dist/cjs/src/fields/CronHour.cjs +59 -0
- package/dist/cjs/src/fields/CronHour.cjs.map +10 -0
- package/dist/cjs/src/fields/CronMinute.cjs +59 -0
- package/dist/cjs/src/fields/CronMinute.cjs.map +10 -0
- package/dist/cjs/src/fields/CronMonth.cjs +63 -0
- package/dist/cjs/src/fields/CronMonth.cjs.map +10 -0
- package/dist/cjs/src/fields/CronSecond.cjs +59 -0
- package/dist/cjs/src/fields/CronSecond.cjs.map +10 -0
- package/dist/cjs/src/fields/index.cjs +49 -0
- package/dist/cjs/src/fields/index.cjs.map +10 -0
- package/dist/cjs/src/fields/types.cjs +24 -0
- package/dist/cjs/src/fields/types.cjs.map +9 -0
- package/dist/cjs/src/index.cjs +64 -0
- package/dist/cjs/src/index.cjs.map +10 -0
- package/dist/cjs/src/utils/random.cjs +56 -0
- package/dist/cjs/src/utils/random.cjs.map +10 -0
- package/dist/mjs/index.mjs +8 -0
- package/dist/mjs/index.mjs.map +10 -0
- package/dist/mjs/package.json +5 -0
- package/dist/mjs/src/CronDate.mjs +460 -0
- package/dist/mjs/src/CronDate.mjs.map +10 -0
- package/dist/mjs/src/CronExpression.mjs +309 -0
- package/dist/mjs/src/CronExpression.mjs.map +10 -0
- package/dist/mjs/src/CronExpressionParser.mjs +277 -0
- package/dist/mjs/src/CronExpressionParser.mjs.map +10 -0
- package/dist/mjs/src/CronFieldCollection.mjs +227 -0
- package/dist/mjs/src/CronFieldCollection.mjs.map +10 -0
- package/dist/mjs/src/fields/CronDayOfMonth.mjs +32 -0
- package/dist/mjs/src/fields/CronDayOfMonth.mjs.map +10 -0
- package/dist/mjs/src/fields/CronDayOfWeek.mjs +35 -0
- package/dist/mjs/src/fields/CronDayOfWeek.mjs.map +10 -0
- package/dist/mjs/src/fields/CronField.mjs +120 -0
- package/dist/mjs/src/fields/CronField.mjs.map +10 -0
- package/dist/mjs/src/fields/CronHour.mjs +29 -0
- package/dist/mjs/src/fields/CronHour.mjs.map +10 -0
- package/dist/mjs/src/fields/CronMinute.mjs +29 -0
- package/dist/mjs/src/fields/CronMinute.mjs.map +10 -0
- package/dist/mjs/src/fields/CronMonth.mjs +33 -0
- package/dist/mjs/src/fields/CronMonth.mjs.map +10 -0
- package/dist/mjs/src/fields/CronSecond.mjs +29 -0
- package/dist/mjs/src/fields/CronSecond.mjs.map +10 -0
- package/dist/mjs/src/fields/index.mjs +11 -0
- package/dist/mjs/src/fields/index.mjs.map +10 -0
- package/dist/mjs/src/fields/types.mjs +2 -0
- package/dist/mjs/src/fields/types.mjs.map +9 -0
- package/dist/mjs/src/index.mjs +18 -0
- package/dist/mjs/src/index.mjs.map +10 -0
- package/dist/mjs/src/utils/random.mjs +26 -0
- package/dist/mjs/src/utils/random.mjs.map +10 -0
- package/dist/types/src/CronDate.d.ts +239 -0
- package/dist/types/src/CronExpression.d.ts +118 -0
- package/dist/types/src/CronExpressionParser.d.ts +71 -0
- package/dist/types/src/CronFieldCollection.d.ts +153 -0
- package/dist/types/src/fields/CronDayOfMonth.d.ts +25 -0
- package/dist/types/src/fields/CronDayOfWeek.d.ts +30 -0
- package/dist/types/src/fields/CronField.d.ts +130 -0
- package/dist/types/src/fields/CronHour.d.ts +23 -0
- package/dist/types/src/fields/CronMinute.d.ts +23 -0
- package/dist/types/src/fields/CronMonth.d.ts +24 -0
- package/dist/types/src/fields/CronSecond.d.ts +23 -0
- package/dist/types/src/fields/types.d.ts +18 -0
- package/{src/index.ts → dist/types/src/index.d.ts} +0 -3
- package/dist/types/src/utils/random.d.ts +10 -0
- package/package.json +20 -9
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.github/workflows/ci.yml +0 -23
- package/.github/workflows/publish.yml +0 -38
- package/CHANGELOG.md +0 -7
- package/CLAUDE.md +0 -111
- package/bun.lock +0 -242
- package/scripts/build.ts +0 -215
- package/src/CronDate.ts +0 -764
- package/src/CronExpression.ts +0 -592
- package/src/CronExpressionParser.ts +0 -467
- package/src/CronFieldCollection.ts +0 -446
- package/src/fields/CronDayOfMonth.ts +0 -46
- package/src/fields/CronDayOfWeek.ts +0 -56
- package/src/fields/CronField.ts +0 -265
- package/src/fields/CronHour.ts +0 -43
- package/src/fields/CronMinute.ts +0 -43
- package/src/fields/CronMonth.ts +0 -48
- package/src/fields/CronSecond.ts +0 -41
- package/src/fields/types.ts +0 -24
- package/src/utils/random.ts +0 -42
- package/tests/CronDate.test.ts +0 -464
- package/tests/CronExpression.test.ts +0 -582
- package/tests/CronExpressionParser.test.ts +0 -1840
- package/tests/CronField.test.ts +0 -60
- package/tests/CronFieldCollection.test.ts +0 -373
- package/tests/browser-smoke.test.ts +0 -13
- package/tests/pure-library.test.ts +0 -45
- package/tests/random.test.ts +0 -34
- package/tsconfig.json +0 -29
- package/tsconfig.typecheck.json +0 -25
- /package/{index.ts → dist/types/index.d.ts} +0 -0
- /package/{src/fields/index.ts → dist/types/src/fields/index.d.ts} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __reExport = (target, mod, secondTarget) => {
|
|
8
|
+
for (let key of __getOwnPropNames(mod))
|
|
9
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
10
|
+
__defProp(target, key, {
|
|
11
|
+
get: () => mod[key],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
if (secondTarget) {
|
|
15
|
+
for (let key of __getOwnPropNames(mod))
|
|
16
|
+
if (!__hasOwnProp.call(secondTarget, key) && key !== "default")
|
|
17
|
+
__defProp(secondTarget, key, {
|
|
18
|
+
get: () => mod[key],
|
|
19
|
+
enumerable: true
|
|
20
|
+
});
|
|
21
|
+
return secondTarget;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
25
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
26
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
27
|
+
for (let key of __getOwnPropNames(mod))
|
|
28
|
+
if (!__hasOwnProp.call(to, key))
|
|
29
|
+
__defProp(to, key, {
|
|
30
|
+
get: () => mod[key],
|
|
31
|
+
enumerable: true
|
|
32
|
+
});
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
36
|
+
var __toCommonJS = (from) => {
|
|
37
|
+
var entry = __moduleCache.get(from), desc;
|
|
38
|
+
if (entry)
|
|
39
|
+
return entry;
|
|
40
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
41
|
+
if (from && typeof from === "object" || typeof from === "function")
|
|
42
|
+
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
43
|
+
get: () => from[key],
|
|
44
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
45
|
+
}));
|
|
46
|
+
__moduleCache.set(from, entry);
|
|
47
|
+
return entry;
|
|
48
|
+
};
|
|
49
|
+
var __export = (target, all) => {
|
|
50
|
+
for (var name in all)
|
|
51
|
+
__defProp(target, name, {
|
|
52
|
+
get: all[name],
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
set: (newValue) => all[name] = () => newValue
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// index.ts
|
|
60
|
+
var exports_richie_cron = {};
|
|
61
|
+
__export(exports_richie_cron, {
|
|
62
|
+
default: () => import_src.default
|
|
63
|
+
});
|
|
64
|
+
module.exports = __toCommonJS(exports_richie_cron);
|
|
65
|
+
__reExport(exports_richie_cron, require("./src.cjs"), module.exports);
|
|
66
|
+
var import_src = __toESM(require("./src.cjs"));
|
|
67
|
+
|
|
68
|
+
//# debugId=4B0EA2BFA070B48164756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export * from './src.cjs';\nexport { default } from './src.cjs';\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACwB,IAAxB;",
|
|
8
|
+
"debugId": "4B0EA2BFA070B48164756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
6
|
+
var __toCommonJS = (from) => {
|
|
7
|
+
var entry = __moduleCache.get(from), desc;
|
|
8
|
+
if (entry)
|
|
9
|
+
return entry;
|
|
10
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function")
|
|
12
|
+
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
}));
|
|
16
|
+
__moduleCache.set(from, entry);
|
|
17
|
+
return entry;
|
|
18
|
+
};
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, {
|
|
22
|
+
get: all[name],
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
set: (newValue) => all[name] = () => newValue
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// src/CronDate.ts
|
|
30
|
+
var exports_CronDate = {};
|
|
31
|
+
__export(exports_CronDate, {
|
|
32
|
+
default: () => CronDate_default,
|
|
33
|
+
TimeUnit: () => TimeUnit,
|
|
34
|
+
DateMathOp: () => DateMathOp,
|
|
35
|
+
DAYS_IN_MONTH: () => DAYS_IN_MONTH,
|
|
36
|
+
CronDate: () => CronDate
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(exports_CronDate);
|
|
39
|
+
var import_date_fns = require("date-fns");
|
|
40
|
+
var import_tz = require("@date-fns/tz");
|
|
41
|
+
var import_tzScan = require("@date-fns/tz/tzScan");
|
|
42
|
+
var import_utc = require("@date-fns/utc");
|
|
43
|
+
var TimeUnit;
|
|
44
|
+
((TimeUnit2) => {
|
|
45
|
+
TimeUnit2["Second"] = "Second";
|
|
46
|
+
TimeUnit2["Minute"] = "Minute";
|
|
47
|
+
TimeUnit2["Hour"] = "Hour";
|
|
48
|
+
TimeUnit2["Day"] = "Day";
|
|
49
|
+
TimeUnit2["Month"] = "Month";
|
|
50
|
+
TimeUnit2["Year"] = "Year";
|
|
51
|
+
})(TimeUnit ||= {});
|
|
52
|
+
var DateMathOp;
|
|
53
|
+
((DateMathOp2) => {
|
|
54
|
+
DateMathOp2["Add"] = "Add";
|
|
55
|
+
DateMathOp2["Subtract"] = "Subtract";
|
|
56
|
+
})(DateMathOp ||= {});
|
|
57
|
+
var DAYS_IN_MONTH = Object.freeze([31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]);
|
|
58
|
+
|
|
59
|
+
class CronDate {
|
|
60
|
+
#date;
|
|
61
|
+
#tz;
|
|
62
|
+
#dstStart = null;
|
|
63
|
+
#dstEnd = null;
|
|
64
|
+
#verbMap = {
|
|
65
|
+
add: {
|
|
66
|
+
["Year" /* Year */]: this.addYear.bind(this),
|
|
67
|
+
["Month" /* Month */]: this.addMonth.bind(this),
|
|
68
|
+
["Day" /* Day */]: this.addDay.bind(this),
|
|
69
|
+
["Hour" /* Hour */]: this.addHour.bind(this),
|
|
70
|
+
["Minute" /* Minute */]: this.addMinute.bind(this),
|
|
71
|
+
["Second" /* Second */]: this.addSecond.bind(this)
|
|
72
|
+
},
|
|
73
|
+
subtract: {
|
|
74
|
+
["Year" /* Year */]: this.subtractYear.bind(this),
|
|
75
|
+
["Month" /* Month */]: this.subtractMonth.bind(this),
|
|
76
|
+
["Day" /* Day */]: this.subtractDay.bind(this),
|
|
77
|
+
["Hour" /* Hour */]: this.subtractHour.bind(this),
|
|
78
|
+
["Minute" /* Minute */]: this.subtractMinute.bind(this),
|
|
79
|
+
["Second" /* Second */]: this.subtractSecond.bind(this)
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
constructor(timestamp, tzName) {
|
|
83
|
+
if (!timestamp) {
|
|
84
|
+
this.#tz = tzName;
|
|
85
|
+
this.#date = this.#fromInstant(Date.now(), this.#tz);
|
|
86
|
+
} else if (timestamp instanceof CronDate) {
|
|
87
|
+
this.#dstStart = timestamp.#dstStart;
|
|
88
|
+
this.#dstEnd = timestamp.#dstEnd;
|
|
89
|
+
this.#tz = tzName ?? timestamp.#tz;
|
|
90
|
+
this.#date = this.#fromInstant(timestamp.getTime(), this.#tz);
|
|
91
|
+
} else {
|
|
92
|
+
this.#tz = tzName;
|
|
93
|
+
if (timestamp instanceof Date) {
|
|
94
|
+
this.#date = this.#fromInstant(timestamp.getTime(), this.#tz);
|
|
95
|
+
} else if (typeof timestamp === "number") {
|
|
96
|
+
this.#date = this.#fromInstant(timestamp, this.#tz);
|
|
97
|
+
} else {
|
|
98
|
+
this.#date = this.#parseStringTimestamp(timestamp, this.#tz);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (!this.#isValidDate(this.#date)) {
|
|
102
|
+
throw new Error(`CronDate: unhandled timestamp: ${timestamp}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
static #isLeapYear(year) {
|
|
106
|
+
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
107
|
+
}
|
|
108
|
+
#contextFn() {
|
|
109
|
+
if (this.#tz === "UTC") {
|
|
110
|
+
return import_utc.utc;
|
|
111
|
+
}
|
|
112
|
+
if (this.#tz) {
|
|
113
|
+
return import_tz.tz(this.#tz);
|
|
114
|
+
}
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
#contextOptions() {
|
|
118
|
+
const inContext = this.#contextFn();
|
|
119
|
+
return inContext ? { in: inContext } : undefined;
|
|
120
|
+
}
|
|
121
|
+
#normalizeDate(date) {
|
|
122
|
+
return this.#fromInstant(date.getTime(), this.#tz);
|
|
123
|
+
}
|
|
124
|
+
#fromInstant(timestamp, tzName) {
|
|
125
|
+
if (tzName === "UTC") {
|
|
126
|
+
return import_utc.utc(timestamp);
|
|
127
|
+
}
|
|
128
|
+
if (tzName) {
|
|
129
|
+
return new import_tz.TZDate(timestamp, tzName);
|
|
130
|
+
}
|
|
131
|
+
return new Date(timestamp);
|
|
132
|
+
}
|
|
133
|
+
#isValidDate(date) {
|
|
134
|
+
return import_date_fns.isValid(date);
|
|
135
|
+
}
|
|
136
|
+
#parseWithFormat(value, format, referenceDate, options) {
|
|
137
|
+
const parsed = import_date_fns.parse(value, format, referenceDate, options);
|
|
138
|
+
return this.#isValidDate(parsed) ? parsed : null;
|
|
139
|
+
}
|
|
140
|
+
#localClockParts(date, tzName) {
|
|
141
|
+
const localized = this.#fromInstant(date.getTime(), tzName);
|
|
142
|
+
return {
|
|
143
|
+
hour: localized.getHours(),
|
|
144
|
+
minute: localized.getMinutes(),
|
|
145
|
+
second: localized.getSeconds()
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
#isSameClock(lhs, rhs) {
|
|
149
|
+
return lhs.hour === rhs.hour && lhs.minute === rhs.minute && lhs.second === rhs.second;
|
|
150
|
+
}
|
|
151
|
+
#clockToSeconds(clock) {
|
|
152
|
+
return clock.hour * 3600 + clock.minute * 60 + clock.second;
|
|
153
|
+
}
|
|
154
|
+
#startOfHourByClock(date) {
|
|
155
|
+
const localized = this.#fromInstant(date.getTime(), this.#tz);
|
|
156
|
+
const diffMs = (localized.getMinutes() * 60 + localized.getSeconds()) * 1000 + localized.getMilliseconds();
|
|
157
|
+
return this.#fromInstant(date.getTime() - diffMs, this.#tz);
|
|
158
|
+
}
|
|
159
|
+
#startOfMinuteByClock(date) {
|
|
160
|
+
const localized = this.#fromInstant(date.getTime(), this.#tz);
|
|
161
|
+
const diffMs = localized.getSeconds() * 1000 + localized.getMilliseconds();
|
|
162
|
+
return this.#fromInstant(date.getTime() - diffMs, this.#tz);
|
|
163
|
+
}
|
|
164
|
+
#endOfHourByClock(date) {
|
|
165
|
+
return this.#fromInstant(this.#startOfHourByClock(date).getTime() + 3599000, this.#tz);
|
|
166
|
+
}
|
|
167
|
+
#endOfMinuteByClock(date) {
|
|
168
|
+
return this.#fromInstant(this.#startOfMinuteByClock(date).getTime() + 59000, this.#tz);
|
|
169
|
+
}
|
|
170
|
+
#adjustDstGap(date, expectedClock, tzName) {
|
|
171
|
+
if (!tzName || tzName === "UTC") {
|
|
172
|
+
return date;
|
|
173
|
+
}
|
|
174
|
+
const actualClock = this.#localClockParts(date, tzName);
|
|
175
|
+
if (this.#isSameClock(actualClock, expectedClock)) {
|
|
176
|
+
return date;
|
|
177
|
+
}
|
|
178
|
+
if (this.#clockToSeconds(actualClock) >= this.#clockToSeconds(expectedClock)) {
|
|
179
|
+
return date;
|
|
180
|
+
}
|
|
181
|
+
const localDate = this.#fromInstant(date.getTime(), tzName);
|
|
182
|
+
const start = new import_tz.TZDate(localDate, tzName);
|
|
183
|
+
start.setHours(0, 0, 0, 0);
|
|
184
|
+
const end = new import_tz.TZDate(localDate, tzName);
|
|
185
|
+
end.setHours(23, 59, 59, 999);
|
|
186
|
+
const forwardChange = import_tzScan.tzScan(tzName, { start, end }).find((change) => change.change > 0);
|
|
187
|
+
if (!forwardChange) {
|
|
188
|
+
return date;
|
|
189
|
+
}
|
|
190
|
+
return this.#fromInstant(date.getTime() + forwardChange.change * 60000, tzName);
|
|
191
|
+
}
|
|
192
|
+
#parseStringTimestamp(timestamp, tzName) {
|
|
193
|
+
const options = tzName ? { in: tzName === "UTC" ? import_utc.utc : import_tz.tz(tzName) } : undefined;
|
|
194
|
+
const referenceDate = options?.in ? options.in(Date.now()) : new Date;
|
|
195
|
+
const isoDateOnlyPattern = /^\d{4}-\d{2}-\d{2}$/;
|
|
196
|
+
const isoNoOffsetPattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?$/;
|
|
197
|
+
const isoWithOffsetPattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?(?:Z|[+-]\d{2}(?::?\d{2})?)$/;
|
|
198
|
+
if (isoDateOnlyPattern.test(timestamp) || isoNoOffsetPattern.test(timestamp) || isoWithOffsetPattern.test(timestamp)) {
|
|
199
|
+
const isoDate = import_date_fns.parseISO(timestamp, options);
|
|
200
|
+
if (this.#isValidDate(isoDate)) {
|
|
201
|
+
if (isoNoOffsetPattern.test(timestamp) && tzName) {
|
|
202
|
+
const [, hour, minute, second] = timestamp.match(/T(\d{2}):(\d{2}):(\d{2})/) ?? [];
|
|
203
|
+
const adjusted = this.#adjustDstGap(isoDate, {
|
|
204
|
+
hour: Number(hour),
|
|
205
|
+
minute: Number(minute),
|
|
206
|
+
second: Number(second)
|
|
207
|
+
}, tzName);
|
|
208
|
+
return this.#normalizeDate(adjusted);
|
|
209
|
+
}
|
|
210
|
+
return this.#normalizeDate(isoDate);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const rfcDate = this.#parseWithFormat(timestamp, "EEE, d MMM yyyy HH:mm:ss xx", referenceDate, options);
|
|
214
|
+
if (rfcDate) {
|
|
215
|
+
return this.#normalizeDate(rfcDate);
|
|
216
|
+
}
|
|
217
|
+
const rfcNoOffsetDate = this.#parseWithFormat(timestamp, "EEE, d MMM yyyy HH:mm:ss", referenceDate, options);
|
|
218
|
+
if (rfcNoOffsetDate) {
|
|
219
|
+
const [, hour, minute, second] = timestamp.match(/(?:\d{4}\s+)?(\d{2}):(\d{2}):(\d{2})$/) ?? [];
|
|
220
|
+
const adjusted = this.#adjustDstGap(rfcNoOffsetDate, {
|
|
221
|
+
hour: Number(hour),
|
|
222
|
+
minute: Number(minute),
|
|
223
|
+
second: Number(second)
|
|
224
|
+
}, tzName);
|
|
225
|
+
return this.#normalizeDate(adjusted);
|
|
226
|
+
}
|
|
227
|
+
if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(timestamp)) {
|
|
228
|
+
const sqlDate = this.#parseWithFormat(timestamp, "yyyy-MM-dd HH:mm:ss", referenceDate, options);
|
|
229
|
+
if (sqlDate) {
|
|
230
|
+
const [, hour, minute, second] = timestamp.match(/(\d{2}):(\d{2}):(\d{2})$/) ?? [];
|
|
231
|
+
const adjusted = this.#adjustDstGap(sqlDate, {
|
|
232
|
+
hour: Number(hour),
|
|
233
|
+
minute: Number(minute),
|
|
234
|
+
second: Number(second)
|
|
235
|
+
}, tzName);
|
|
236
|
+
return this.#normalizeDate(adjusted);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
throw new Error(`CronDate: unhandled timestamp: ${timestamp}`);
|
|
240
|
+
}
|
|
241
|
+
get dstStart() {
|
|
242
|
+
return this.#dstStart;
|
|
243
|
+
}
|
|
244
|
+
set dstStart(value) {
|
|
245
|
+
this.#dstStart = value;
|
|
246
|
+
}
|
|
247
|
+
get dstEnd() {
|
|
248
|
+
return this.#dstEnd;
|
|
249
|
+
}
|
|
250
|
+
set dstEnd(value) {
|
|
251
|
+
this.#dstEnd = value;
|
|
252
|
+
}
|
|
253
|
+
addYear() {
|
|
254
|
+
this.#date = this.#normalizeDate(import_date_fns.addYears(this.#date, 1, this.#contextOptions()));
|
|
255
|
+
}
|
|
256
|
+
addMonth() {
|
|
257
|
+
const options = this.#contextOptions();
|
|
258
|
+
this.#date = this.#normalizeDate(import_date_fns.startOfMonth(import_date_fns.addMonths(this.#date, 1, options), options));
|
|
259
|
+
}
|
|
260
|
+
addDay() {
|
|
261
|
+
const options = this.#contextOptions();
|
|
262
|
+
this.#date = this.#normalizeDate(import_date_fns.startOfDay(import_date_fns.addDays(this.#date, 1, options), options));
|
|
263
|
+
}
|
|
264
|
+
addHour() {
|
|
265
|
+
const shifted = this.#fromInstant(this.getTime() + 3600000, this.#tz);
|
|
266
|
+
this.#date = this.#normalizeDate(this.#startOfHourByClock(shifted));
|
|
267
|
+
}
|
|
268
|
+
addMinute() {
|
|
269
|
+
const shifted = this.#fromInstant(this.getTime() + 60000, this.#tz);
|
|
270
|
+
this.#date = this.#normalizeDate(this.#startOfMinuteByClock(shifted));
|
|
271
|
+
}
|
|
272
|
+
addSecond() {
|
|
273
|
+
this.#date = this.#normalizeDate(this.#fromInstant(this.getTime() + 1000, this.#tz));
|
|
274
|
+
}
|
|
275
|
+
subtractYear() {
|
|
276
|
+
this.#date = this.#normalizeDate(import_date_fns.subYears(this.#date, 1, this.#contextOptions()));
|
|
277
|
+
}
|
|
278
|
+
subtractMonth() {
|
|
279
|
+
const options = this.#contextOptions();
|
|
280
|
+
this.#date = this.#normalizeDate(import_date_fns.startOfSecond(import_date_fns.endOfMonth(import_date_fns.subMonths(this.#date, 1, options), options), options));
|
|
281
|
+
}
|
|
282
|
+
subtractDay() {
|
|
283
|
+
const options = this.#contextOptions();
|
|
284
|
+
this.#date = this.#normalizeDate(import_date_fns.startOfSecond(import_date_fns.endOfDay(import_date_fns.subDays(this.#date, 1, options), options), options));
|
|
285
|
+
}
|
|
286
|
+
subtractHour() {
|
|
287
|
+
const shifted = this.#fromInstant(this.getTime() - 3600000, this.#tz);
|
|
288
|
+
this.#date = this.#normalizeDate(this.#endOfHourByClock(shifted));
|
|
289
|
+
}
|
|
290
|
+
subtractMinute() {
|
|
291
|
+
const shifted = this.#fromInstant(this.getTime() - 60000, this.#tz);
|
|
292
|
+
this.#date = this.#normalizeDate(this.#endOfMinuteByClock(shifted));
|
|
293
|
+
}
|
|
294
|
+
subtractSecond() {
|
|
295
|
+
this.#date = this.#normalizeDate(this.#fromInstant(this.getTime() - 1000, this.#tz));
|
|
296
|
+
}
|
|
297
|
+
addUnit(unit) {
|
|
298
|
+
this.#verbMap.add[unit]();
|
|
299
|
+
}
|
|
300
|
+
subtractUnit(unit) {
|
|
301
|
+
this.#verbMap.subtract[unit]();
|
|
302
|
+
}
|
|
303
|
+
invokeDateOperation(verb, unit) {
|
|
304
|
+
if (verb === "Add" /* Add */) {
|
|
305
|
+
this.addUnit(unit);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
if (verb === "Subtract" /* Subtract */) {
|
|
309
|
+
this.subtractUnit(unit);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
throw new Error(`Invalid verb: ${verb}`);
|
|
313
|
+
}
|
|
314
|
+
getDate() {
|
|
315
|
+
return this.#date.getDate();
|
|
316
|
+
}
|
|
317
|
+
getFullYear() {
|
|
318
|
+
return this.#date.getFullYear();
|
|
319
|
+
}
|
|
320
|
+
getDay() {
|
|
321
|
+
return this.#date.getDay();
|
|
322
|
+
}
|
|
323
|
+
getMonth() {
|
|
324
|
+
return this.#date.getMonth();
|
|
325
|
+
}
|
|
326
|
+
getHours() {
|
|
327
|
+
return this.#date.getHours();
|
|
328
|
+
}
|
|
329
|
+
getMinutes() {
|
|
330
|
+
return this.#date.getMinutes();
|
|
331
|
+
}
|
|
332
|
+
getSeconds() {
|
|
333
|
+
return this.#date.getSeconds();
|
|
334
|
+
}
|
|
335
|
+
getMilliseconds() {
|
|
336
|
+
return this.#date.getMilliseconds();
|
|
337
|
+
}
|
|
338
|
+
getUTCOffset() {
|
|
339
|
+
return -this.#date.getTimezoneOffset();
|
|
340
|
+
}
|
|
341
|
+
setStartOfDay() {
|
|
342
|
+
this.#date = this.#normalizeDate(import_date_fns.startOfDay(this.#date, this.#contextOptions()));
|
|
343
|
+
}
|
|
344
|
+
setEndOfDay() {
|
|
345
|
+
this.#date = this.#normalizeDate(import_date_fns.endOfDay(this.#date, this.#contextOptions()));
|
|
346
|
+
}
|
|
347
|
+
getTime() {
|
|
348
|
+
return this.#date.getTime();
|
|
349
|
+
}
|
|
350
|
+
getUTCDate() {
|
|
351
|
+
return this.#getUTC().getUTCDate();
|
|
352
|
+
}
|
|
353
|
+
getUTCFullYear() {
|
|
354
|
+
return this.#getUTC().getUTCFullYear();
|
|
355
|
+
}
|
|
356
|
+
getUTCDay() {
|
|
357
|
+
return this.#getUTC().getUTCDay();
|
|
358
|
+
}
|
|
359
|
+
getUTCMonth() {
|
|
360
|
+
return this.#getUTC().getUTCMonth();
|
|
361
|
+
}
|
|
362
|
+
getUTCHours() {
|
|
363
|
+
return this.#getUTC().getUTCHours();
|
|
364
|
+
}
|
|
365
|
+
getUTCMinutes() {
|
|
366
|
+
return this.#getUTC().getUTCMinutes();
|
|
367
|
+
}
|
|
368
|
+
getUTCSeconds() {
|
|
369
|
+
return this.#getUTC().getUTCSeconds();
|
|
370
|
+
}
|
|
371
|
+
toISOString() {
|
|
372
|
+
return this.#getUTC().toISOString();
|
|
373
|
+
}
|
|
374
|
+
toJSON() {
|
|
375
|
+
return this.#getUTC().toJSON();
|
|
376
|
+
}
|
|
377
|
+
setDate(d) {
|
|
378
|
+
this.#date = this.#normalizeDate(import_date_fns.setDate(this.#date, d, this.#contextOptions()));
|
|
379
|
+
}
|
|
380
|
+
setFullYear(y) {
|
|
381
|
+
this.#date = this.#normalizeDate(import_date_fns.setYear(this.#date, y, this.#contextOptions()));
|
|
382
|
+
}
|
|
383
|
+
setDay(d) {
|
|
384
|
+
const targetDay = (d % 7 + 7) % 7;
|
|
385
|
+
const dayDiff = targetDay - this.getDay();
|
|
386
|
+
this.#date = this.#normalizeDate(import_date_fns.addDays(this.#date, dayDiff, this.#contextOptions()));
|
|
387
|
+
}
|
|
388
|
+
setMonth(m) {
|
|
389
|
+
this.#date = this.#normalizeDate(import_date_fns.setMonth(this.#date, m, this.#contextOptions()));
|
|
390
|
+
}
|
|
391
|
+
setHours(h) {
|
|
392
|
+
if (this.getHours() === h) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
this.#date = this.#normalizeDate(import_date_fns.setHours(this.#date, h, this.#contextOptions()));
|
|
396
|
+
}
|
|
397
|
+
setMinutes(m) {
|
|
398
|
+
if (this.getMinutes() === m) {
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
this.#date = this.#normalizeDate(import_date_fns.setMinutes(this.#date, m, this.#contextOptions()));
|
|
402
|
+
}
|
|
403
|
+
setSeconds(s) {
|
|
404
|
+
if (this.getSeconds() === s) {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
this.#date = this.#normalizeDate(import_date_fns.setSeconds(this.#date, s, this.#contextOptions()));
|
|
408
|
+
}
|
|
409
|
+
setMilliseconds(s) {
|
|
410
|
+
if (this.getMilliseconds() === s) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
this.#date = this.#normalizeDate(import_date_fns.setMilliseconds(this.#date, s, this.#contextOptions()));
|
|
414
|
+
}
|
|
415
|
+
toString() {
|
|
416
|
+
return this.toDate().toString();
|
|
417
|
+
}
|
|
418
|
+
toDate() {
|
|
419
|
+
return new Date(this.#date.getTime());
|
|
420
|
+
}
|
|
421
|
+
isLastDayOfMonth() {
|
|
422
|
+
const day = this.getDate();
|
|
423
|
+
const month = this.getMonth() + 1;
|
|
424
|
+
const year = this.getFullYear();
|
|
425
|
+
if (month === 2) {
|
|
426
|
+
const isLeap = CronDate.#isLeapYear(year);
|
|
427
|
+
return day === DAYS_IN_MONTH[month - 1] - (isLeap ? 0 : 1);
|
|
428
|
+
}
|
|
429
|
+
return day === DAYS_IN_MONTH[month - 1];
|
|
430
|
+
}
|
|
431
|
+
isLastWeekdayOfMonth() {
|
|
432
|
+
const day = this.getDate();
|
|
433
|
+
const month = this.getMonth() + 1;
|
|
434
|
+
const year = this.getFullYear();
|
|
435
|
+
let lastDay;
|
|
436
|
+
if (month === 2) {
|
|
437
|
+
lastDay = DAYS_IN_MONTH[month - 1] - (CronDate.#isLeapYear(year) ? 0 : 1);
|
|
438
|
+
} else {
|
|
439
|
+
lastDay = DAYS_IN_MONTH[month - 1];
|
|
440
|
+
}
|
|
441
|
+
return day > lastDay - 7;
|
|
442
|
+
}
|
|
443
|
+
applyDateOperation(op, unit, hoursLength) {
|
|
444
|
+
if (unit === "Month" /* Month */ || unit === "Day" /* Day */) {
|
|
445
|
+
this.invokeDateOperation(op, unit);
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
const previousHour = this.getHours();
|
|
449
|
+
this.invokeDateOperation(op, unit);
|
|
450
|
+
const currentHour = this.getHours();
|
|
451
|
+
const diff = currentHour - previousHour;
|
|
452
|
+
if (diff === 2) {
|
|
453
|
+
if (hoursLength !== 24) {
|
|
454
|
+
this.dstStart = currentHour;
|
|
455
|
+
}
|
|
456
|
+
} else if (diff === 0 && this.getMinutes() === 0 && this.getSeconds() === 0) {
|
|
457
|
+
if (hoursLength !== 24) {
|
|
458
|
+
this.dstEnd = currentHour;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
#getUTC() {
|
|
463
|
+
return new Date(this.#date.getTime());
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
var CronDate_default = CronDate;
|
|
467
|
+
|
|
468
|
+
//# debugId=468D6FA41034F01264756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/CronDate.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import {\n addDays,\n addHours,\n addMinutes,\n addMonths,\n addSeconds,\n addYears,\n endOfDay,\n endOfHour,\n endOfMinute,\n endOfMonth,\n isValid,\n parse,\n parseISO,\n setDate as setDateValue,\n setHours as setHoursValue,\n setMilliseconds as setMillisecondsValue,\n setMinutes as setMinutesValue,\n setMonth as setMonthValue,\n setSeconds as setSecondsValue,\n setYear,\n startOfDay,\n startOfHour,\n startOfMinute,\n startOfMonth,\n startOfSecond,\n subDays,\n subHours,\n subMinutes,\n subMonths,\n subSeconds,\n subYears,\n} from 'date-fns';\nimport { TZDate, tz } from '@date-fns/tz';\nimport { tzScan } from '@date-fns/tz/tzScan';\nimport { utc } from '@date-fns/utc';\n\nexport enum TimeUnit {\n Second = 'Second',\n Minute = 'Minute',\n Hour = 'Hour',\n Day = 'Day',\n Month = 'Month',\n Year = 'Year',\n}\n\nexport enum DateMathOp {\n Add = 'Add',\n Subtract = 'Subtract',\n}\n\ntype VerbMap = {\n [key in TimeUnit]: () => void;\n};\n\nexport const DAYS_IN_MONTH: readonly number[] = Object.freeze([31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]);\n\ntype ContextFn = (value: Date | number | string) => Date;\ntype ClockParts = {\n hour: number;\n minute: number;\n second: number;\n};\n\n/**\n * CronDate class that wraps Date-compatible values to provide\n * a consistent API for working with dates and times in the context of cron.\n */\nexport class CronDate {\n #date: Date;\n #tz?: string;\n #dstStart: number | null = null;\n #dstEnd: number | null = null;\n\n /**\n * Maps the verb to the appropriate method.\n */\n #verbMap: { add: VerbMap; subtract: VerbMap } = {\n add: {\n [TimeUnit.Year]: this.addYear.bind(this),\n [TimeUnit.Month]: this.addMonth.bind(this),\n [TimeUnit.Day]: this.addDay.bind(this),\n [TimeUnit.Hour]: this.addHour.bind(this),\n [TimeUnit.Minute]: this.addMinute.bind(this),\n [TimeUnit.Second]: this.addSecond.bind(this),\n },\n subtract: {\n [TimeUnit.Year]: this.subtractYear.bind(this),\n [TimeUnit.Month]: this.subtractMonth.bind(this),\n [TimeUnit.Day]: this.subtractDay.bind(this),\n [TimeUnit.Hour]: this.subtractHour.bind(this),\n [TimeUnit.Minute]: this.subtractMinute.bind(this),\n [TimeUnit.Second]: this.subtractSecond.bind(this),\n },\n };\n\n /**\n * Constructs a new CronDate instance.\n * @param {CronDate | Date | number | string} [timestamp] - The timestamp to initialize the CronDate with.\n * @param {string} [tzName] - The timezone to use for the CronDate.\n */\n constructor(timestamp?: CronDate | Date | number | string, tzName?: string) {\n if (!timestamp) {\n this.#tz = tzName;\n this.#date = this.#fromInstant(Date.now(), this.#tz);\n } else if (timestamp instanceof CronDate) {\n this.#dstStart = timestamp.#dstStart;\n this.#dstEnd = timestamp.#dstEnd;\n this.#tz = tzName ?? timestamp.#tz;\n this.#date = this.#fromInstant(timestamp.getTime(), this.#tz);\n } else {\n this.#tz = tzName;\n\n if (timestamp instanceof Date) {\n this.#date = this.#fromInstant(timestamp.getTime(), this.#tz);\n } else if (typeof timestamp === 'number') {\n this.#date = this.#fromInstant(timestamp, this.#tz);\n } else {\n this.#date = this.#parseStringTimestamp(timestamp, this.#tz);\n }\n }\n\n if (!this.#isValidDate(this.#date)) {\n throw new Error(`CronDate: unhandled timestamp: ${timestamp}`);\n }\n }\n\n /**\n * Determines if the given year is a leap year.\n * @param {number} year - The year to check.\n * @returns {boolean} - True if the year is a leap year, false otherwise.\n */\n static #isLeapYear(year: number): boolean {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n }\n\n #contextFn(): ContextFn | undefined {\n if (this.#tz === 'UTC') {\n return utc;\n }\n if (this.#tz) {\n return tz(this.#tz);\n }\n return undefined;\n }\n\n #contextOptions(): { in: ContextFn } | undefined {\n const inContext = this.#contextFn();\n return inContext ? { in: inContext } : undefined;\n }\n\n #normalizeDate(date: Date): Date {\n return this.#fromInstant(date.getTime(), this.#tz);\n }\n\n #fromInstant(timestamp: number, tzName?: string): Date {\n if (tzName === 'UTC') {\n return utc(timestamp);\n }\n if (tzName) {\n return new TZDate(timestamp, tzName);\n }\n return new Date(timestamp);\n }\n\n #isValidDate(date: Date): boolean {\n return isValid(date);\n }\n\n #parseWithFormat(\n value: string,\n format: string,\n referenceDate: Date,\n options?: { in: ContextFn },\n ): Date | null {\n const parsed = parse(value, format, referenceDate, options);\n return this.#isValidDate(parsed) ? parsed : null;\n }\n\n #localClockParts(date: Date, tzName?: string): ClockParts {\n const localized = this.#fromInstant(date.getTime(), tzName);\n return {\n hour: localized.getHours(),\n minute: localized.getMinutes(),\n second: localized.getSeconds(),\n };\n }\n\n #isSameClock(lhs: ClockParts, rhs: ClockParts): boolean {\n return lhs.hour === rhs.hour && lhs.minute === rhs.minute && lhs.second === rhs.second;\n }\n\n #clockToSeconds(clock: ClockParts): number {\n return clock.hour * 3600 + clock.minute * 60 + clock.second;\n }\n\n #startOfHourByClock(date: Date): Date {\n const localized = this.#fromInstant(date.getTime(), this.#tz);\n const diffMs =\n ((localized.getMinutes() * 60 + localized.getSeconds()) * 1_000) + localized.getMilliseconds();\n return this.#fromInstant(date.getTime() - diffMs, this.#tz);\n }\n\n #startOfMinuteByClock(date: Date): Date {\n const localized = this.#fromInstant(date.getTime(), this.#tz);\n const diffMs = localized.getSeconds() * 1_000 + localized.getMilliseconds();\n return this.#fromInstant(date.getTime() - diffMs, this.#tz);\n }\n\n #endOfHourByClock(date: Date): Date {\n return this.#fromInstant(this.#startOfHourByClock(date).getTime() + 3_599_000, this.#tz);\n }\n\n #endOfMinuteByClock(date: Date): Date {\n return this.#fromInstant(this.#startOfMinuteByClock(date).getTime() + 59_000, this.#tz);\n }\n\n #adjustDstGap(date: Date, expectedClock: ClockParts, tzName?: string): Date {\n if (!tzName || tzName === 'UTC') {\n return date;\n }\n\n const actualClock = this.#localClockParts(date, tzName);\n if (this.#isSameClock(actualClock, expectedClock)) {\n return date;\n }\n\n // On DST-start gap parsing, date-fns/tz can normalize to an earlier hour.\n // If that happens, move forward by the DST change amount on that day.\n if (this.#clockToSeconds(actualClock) >= this.#clockToSeconds(expectedClock)) {\n return date;\n }\n\n const localDate = this.#fromInstant(date.getTime(), tzName);\n const start = new TZDate(localDate, tzName);\n start.setHours(0, 0, 0, 0);\n const end = new TZDate(localDate, tzName);\n end.setHours(23, 59, 59, 999);\n\n const forwardChange = tzScan(tzName, { start, end }).find((change) => change.change > 0);\n if (!forwardChange) {\n return date;\n }\n\n return this.#fromInstant(date.getTime() + forwardChange.change * 60_000, tzName);\n }\n\n #parseStringTimestamp(timestamp: string, tzName?: string): Date {\n const options = tzName ? { in: tzName === 'UTC' ? utc : tz(tzName) } : undefined;\n const referenceDate = options?.in ? options.in(Date.now()) : new Date();\n\n const isoDateOnlyPattern = /^\\d{4}-\\d{2}-\\d{2}$/;\n const isoNoOffsetPattern = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?$/;\n const isoWithOffsetPattern = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?(?:Z|[+-]\\d{2}(?::?\\d{2})?)$/;\n\n if (isoDateOnlyPattern.test(timestamp) || isoNoOffsetPattern.test(timestamp) || isoWithOffsetPattern.test(timestamp)) {\n const isoDate = parseISO(timestamp, options as Parameters<typeof parseISO>[1]);\n if (this.#isValidDate(isoDate)) {\n if (isoNoOffsetPattern.test(timestamp) && tzName) {\n const [, hour, minute, second] = timestamp.match(/T(\\d{2}):(\\d{2}):(\\d{2})/) ?? [];\n const adjusted = this.#adjustDstGap(\n isoDate,\n {\n hour: Number(hour),\n minute: Number(minute),\n second: Number(second),\n },\n tzName,\n );\n return this.#normalizeDate(adjusted);\n }\n return this.#normalizeDate(isoDate);\n }\n }\n\n const rfcDate = this.#parseWithFormat(timestamp, 'EEE, d MMM yyyy HH:mm:ss xx', referenceDate, options);\n if (rfcDate) {\n return this.#normalizeDate(rfcDate);\n }\n\n const rfcNoOffsetDate = this.#parseWithFormat(timestamp, 'EEE, d MMM yyyy HH:mm:ss', referenceDate, options);\n if (rfcNoOffsetDate) {\n const [, hour, minute, second] =\n timestamp.match(/(?:\\d{4}\\s+)?(\\d{2}):(\\d{2}):(\\d{2})$/) ?? [];\n const adjusted = this.#adjustDstGap(\n rfcNoOffsetDate,\n {\n hour: Number(hour),\n minute: Number(minute),\n second: Number(second),\n },\n tzName,\n );\n return this.#normalizeDate(adjusted);\n }\n\n if (/^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$/.test(timestamp)) {\n const sqlDate = this.#parseWithFormat(timestamp, 'yyyy-MM-dd HH:mm:ss', referenceDate, options);\n if (sqlDate) {\n const [, hour, minute, second] = timestamp.match(/(\\d{2}):(\\d{2}):(\\d{2})$/) ?? [];\n const adjusted = this.#adjustDstGap(\n sqlDate,\n {\n hour: Number(hour),\n minute: Number(minute),\n second: Number(second),\n },\n tzName,\n );\n return this.#normalizeDate(adjusted);\n }\n }\n\n throw new Error(`CronDate: unhandled timestamp: ${timestamp}`);\n }\n\n /**\n * Returns daylight savings start time.\n */\n get dstStart(): number | null {\n return this.#dstStart;\n }\n\n /**\n * Sets daylight savings start time.\n */\n set dstStart(value: number | null) {\n this.#dstStart = value;\n }\n\n /**\n * Returns daylight savings end time.\n */\n get dstEnd(): number | null {\n return this.#dstEnd;\n }\n\n /**\n * Sets daylight savings end time.\n */\n set dstEnd(value: number | null) {\n this.#dstEnd = value;\n }\n\n /**\n * Adds one year to the current CronDate.\n */\n addYear(): void {\n this.#date = this.#normalizeDate(addYears(this.#date, 1, this.#contextOptions()));\n }\n\n /**\n * Adds one month to the current CronDate.\n */\n addMonth(): void {\n const options = this.#contextOptions();\n this.#date = this.#normalizeDate(startOfMonth(addMonths(this.#date, 1, options), options));\n }\n\n /**\n * Adds one day to the current CronDate.\n */\n addDay(): void {\n const options = this.#contextOptions();\n this.#date = this.#normalizeDate(startOfDay(addDays(this.#date, 1, options), options));\n }\n\n /**\n * Adds one hour to the current CronDate.\n */\n addHour(): void {\n const shifted = this.#fromInstant(this.getTime() + 3_600_000, this.#tz);\n this.#date = this.#normalizeDate(this.#startOfHourByClock(shifted));\n }\n\n /**\n * Adds one minute to the current CronDate.\n */\n addMinute(): void {\n const shifted = this.#fromInstant(this.getTime() + 60_000, this.#tz);\n this.#date = this.#normalizeDate(this.#startOfMinuteByClock(shifted));\n }\n\n /**\n * Adds one second to the current CronDate.\n */\n addSecond(): void {\n this.#date = this.#normalizeDate(this.#fromInstant(this.getTime() + 1_000, this.#tz));\n }\n\n /**\n * Subtracts one year from the current CronDate.\n */\n subtractYear(): void {\n this.#date = this.#normalizeDate(subYears(this.#date, 1, this.#contextOptions()));\n }\n\n /**\n * Subtracts one month from the current CronDate.\n */\n subtractMonth(): void {\n const options = this.#contextOptions();\n this.#date = this.#normalizeDate(startOfSecond(endOfMonth(subMonths(this.#date, 1, options), options), options));\n }\n\n /**\n * Subtracts one day from the current CronDate.\n */\n subtractDay(): void {\n const options = this.#contextOptions();\n this.#date = this.#normalizeDate(startOfSecond(endOfDay(subDays(this.#date, 1, options), options), options));\n }\n\n /**\n * Subtracts one hour from the current CronDate.\n */\n subtractHour(): void {\n const shifted = this.#fromInstant(this.getTime() - 3_600_000, this.#tz);\n this.#date = this.#normalizeDate(this.#endOfHourByClock(shifted));\n }\n\n /**\n * Subtracts one minute from the current CronDate.\n */\n subtractMinute(): void {\n const shifted = this.#fromInstant(this.getTime() - 60_000, this.#tz);\n this.#date = this.#normalizeDate(this.#endOfMinuteByClock(shifted));\n }\n\n /**\n * Subtracts one second from the current CronDate.\n */\n subtractSecond(): void {\n this.#date = this.#normalizeDate(this.#fromInstant(this.getTime() - 1_000, this.#tz));\n }\n\n /**\n * Adds a unit of time to the current CronDate.\n */\n addUnit(unit: TimeUnit): void {\n this.#verbMap.add[unit]();\n }\n\n /**\n * Subtracts a unit of time from the current CronDate.\n */\n subtractUnit(unit: TimeUnit): void {\n this.#verbMap.subtract[unit]();\n }\n\n /**\n * Handles a math operation.\n */\n invokeDateOperation(verb: DateMathOp, unit: TimeUnit) {\n if (verb === DateMathOp.Add) {\n this.addUnit(unit);\n return;\n }\n if (verb === DateMathOp.Subtract) {\n this.subtractUnit(unit);\n return;\n }\n throw new Error(`Invalid verb: ${verb}`);\n }\n\n /**\n * Returns the day.\n */\n getDate(): number {\n return this.#date.getDate();\n }\n\n /**\n * Returns the year.\n */\n getFullYear(): number {\n return this.#date.getFullYear();\n }\n\n /**\n * Returns the day of the week.\n */\n getDay(): number {\n return this.#date.getDay();\n }\n\n /**\n * Returns the month.\n */\n getMonth(): number {\n return this.#date.getMonth();\n }\n\n /**\n * Returns the hour.\n */\n getHours(): number {\n return this.#date.getHours();\n }\n\n /**\n * Returns the minutes.\n */\n getMinutes(): number {\n return this.#date.getMinutes();\n }\n\n /**\n * Returns the seconds.\n */\n getSeconds(): number {\n return this.#date.getSeconds();\n }\n\n /**\n * Returns the milliseconds.\n */\n getMilliseconds(): number {\n return this.#date.getMilliseconds();\n }\n\n /**\n * Returns the timezone offset from UTC in minutes (e.g. UTC+2 => 120).\n */\n getUTCOffset(): number {\n return -this.#date.getTimezoneOffset();\n }\n\n /**\n * Sets the time to the start of the day (00:00:00.000) in the current timezone.\n */\n setStartOfDay(): void {\n this.#date = this.#normalizeDate(startOfDay(this.#date, this.#contextOptions()));\n }\n\n /**\n * Sets the time to the end of the day (23:59:59.999) in the current timezone.\n */\n setEndOfDay(): void {\n this.#date = this.#normalizeDate(endOfDay(this.#date, this.#contextOptions()));\n }\n\n /**\n * Returns the time.\n */\n getTime(): number {\n return this.#date.getTime();\n }\n\n /**\n * Returns the UTC day.\n */\n getUTCDate(): number {\n return this.#getUTC().getUTCDate();\n }\n\n /**\n * Returns the UTC year.\n */\n getUTCFullYear(): number {\n return this.#getUTC().getUTCFullYear();\n }\n\n /**\n * Returns the UTC day of the week.\n */\n getUTCDay(): number {\n return this.#getUTC().getUTCDay();\n }\n\n /**\n * Returns the UTC month.\n */\n getUTCMonth(): number {\n return this.#getUTC().getUTCMonth();\n }\n\n /**\n * Returns the UTC hour.\n */\n getUTCHours(): number {\n return this.#getUTC().getUTCHours();\n }\n\n /**\n * Returns the UTC minutes.\n */\n getUTCMinutes(): number {\n return this.#getUTC().getUTCMinutes();\n }\n\n /**\n * Returns the UTC seconds.\n */\n getUTCSeconds(): number {\n return this.#getUTC().getUTCSeconds();\n }\n\n /**\n * Returns the UTC milliseconds.\n */\n toISOString(): string {\n return this.#getUTC().toISOString();\n }\n\n /**\n * Returns the date as a JSON string.\n */\n toJSON(): string {\n return this.#getUTC().toJSON();\n }\n\n /**\n * Sets the day.\n */\n setDate(d: number): void {\n this.#date = this.#normalizeDate(setDateValue(this.#date, d, this.#contextOptions()));\n }\n\n /**\n * Sets the year.\n */\n setFullYear(y: number): void {\n this.#date = this.#normalizeDate(setYear(this.#date, y, this.#contextOptions()));\n }\n\n /**\n * Sets the day of the week.\n */\n setDay(d: number): void {\n const targetDay = ((d % 7) + 7) % 7;\n const dayDiff = targetDay - this.getDay();\n this.#date = this.#normalizeDate(addDays(this.#date, dayDiff, this.#contextOptions()));\n }\n\n /**\n * Sets the month.\n */\n setMonth(m: number): void {\n this.#date = this.#normalizeDate(setMonthValue(this.#date, m, this.#contextOptions()));\n }\n\n /**\n * Sets the hour.\n */\n setHours(h: number): void {\n if (this.getHours() === h) {\n return;\n }\n this.#date = this.#normalizeDate(setHoursValue(this.#date, h, this.#contextOptions()));\n }\n\n /**\n * Sets the minutes.\n */\n setMinutes(m: number): void {\n if (this.getMinutes() === m) {\n return;\n }\n this.#date = this.#normalizeDate(setMinutesValue(this.#date, m, this.#contextOptions()));\n }\n\n /**\n * Sets the seconds.\n */\n setSeconds(s: number): void {\n if (this.getSeconds() === s) {\n return;\n }\n this.#date = this.#normalizeDate(setSecondsValue(this.#date, s, this.#contextOptions()));\n }\n\n /**\n * Sets the milliseconds.\n */\n setMilliseconds(s: number): void {\n if (this.getMilliseconds() === s) {\n return;\n }\n this.#date = this.#normalizeDate(setMillisecondsValue(this.#date, s, this.#contextOptions()));\n }\n\n /**\n * Returns the date as a string.\n */\n toString(): string {\n return this.toDate().toString();\n }\n\n /**\n * Returns the date as a Date object.\n */\n toDate(): Date {\n return new Date(this.#date.getTime());\n }\n\n /**\n * Returns true if the day is the last day of the month.\n */\n isLastDayOfMonth(): boolean {\n const day = this.getDate();\n const month = this.getMonth() + 1;\n const year = this.getFullYear();\n\n if (month === 2) {\n const isLeap = CronDate.#isLeapYear(year);\n return day === DAYS_IN_MONTH[month - 1] - (isLeap ? 0 : 1);\n }\n\n return day === DAYS_IN_MONTH[month - 1];\n }\n\n /**\n * Returns true if the day is the last weekday of the month.\n */\n isLastWeekdayOfMonth(): boolean {\n const day = this.getDate();\n const month = this.getMonth() + 1;\n const year = this.getFullYear();\n\n let lastDay: number;\n if (month === 2) {\n lastDay = DAYS_IN_MONTH[month - 1] - (CronDate.#isLeapYear(year) ? 0 : 1);\n } else {\n lastDay = DAYS_IN_MONTH[month - 1];\n }\n\n return day > lastDay - 7;\n }\n\n /**\n * Primarily for internal use.\n */\n applyDateOperation(op: DateMathOp, unit: TimeUnit, hoursLength?: number): void {\n if (unit === TimeUnit.Month || unit === TimeUnit.Day) {\n this.invokeDateOperation(op, unit);\n return;\n }\n\n const previousHour = this.getHours();\n this.invokeDateOperation(op, unit);\n const currentHour = this.getHours();\n const diff = currentHour - previousHour;\n\n if (diff === 2) {\n if (hoursLength !== 24) {\n this.dstStart = currentHour;\n }\n } else if (diff === 0 && this.getMinutes() === 0 && this.getSeconds() === 0) {\n if (hoursLength !== 24) {\n this.dstEnd = currentHour;\n }\n }\n }\n\n /**\n * Returns the UTC date.\n */\n #getUTC(): Date {\n return new Date(this.#date.getTime());\n }\n}\n\nexport default CronDate;\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCO,IAhCP;AAiC2B,IAA3B;AACuB,IAAvB;AACoB,IAApB;AAEO,IAAK;AAAA,CAAL,CAAK,cAAL;AAAA,EACL,sBAAS;AAAA,EACT,sBAAS;AAAA,EACT,oBAAO;AAAA,EACP,mBAAM;AAAA,EACN,qBAAQ;AAAA,EACR,oBAAO;AAAA,GANG;AASL,IAAK;AAAA,CAAL,CAAK,gBAAL;AAAA,EACL,qBAAM;AAAA,EACN,0BAAW;AAAA,GAFD;AASL,IAAM,gBAAmC,OAAO,OAAO,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;AAAA;AAavG,MAAM,SAAS;AAAA,EACpB;AAAA,EACA;AAAA,EACA,YAA2B;AAAA,EAC3B,UAAyB;AAAA,EAKzB,WAAgD;AAAA,IAC9C,KAAK;AAAA,OACF,oBAAgB,KAAK,QAAQ,KAAK,IAAI;AAAA,OACtC,sBAAiB,KAAK,SAAS,KAAK,IAAI;AAAA,OACxC,kBAAe,KAAK,OAAO,KAAK,IAAI;AAAA,OACpC,oBAAgB,KAAK,Q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