@nocobase/plugin-auth 0.17.0-alpha.7 → 0.18.0-alpha.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/client/authenticator.d.ts +13 -0
- package/dist/client/basic/SignInForm.d.ts +9 -0
- package/dist/client/basic/SignUpForm.d.ts +13 -0
- package/dist/client/basic/index.d.ts +3 -0
- package/dist/client/index.d.ts +21 -0
- package/dist/client/index.js +12 -2
- package/dist/client/pages/AuthLayout.d.ts +2 -0
- package/dist/client/pages/SignInPage.d.ts +16 -0
- package/dist/client/pages/SignUpPage.d.ts +21 -0
- package/dist/client/pages/index.d.ts +3 -0
- package/dist/client/settings/Options.d.ts +3 -2
- package/dist/externalVersion.js +14 -12
- package/dist/locale/en-US.json +4 -1
- package/dist/locale/zh-CN.json +4 -1
- package/dist/node_modules/cron/LICENSE +0 -0
- package/dist/node_modules/cron/lib/cron.js +1 -1
- package/dist/node_modules/cron/lib/job.js +0 -0
- package/dist/node_modules/cron/lib/time.js +33 -20
- package/dist/node_modules/cron/node_modules/luxon/build/amd/luxon.js +7826 -0
- package/dist/node_modules/cron/node_modules/luxon/build/cjs-browser/luxon.js +7824 -0
- package/dist/node_modules/cron/node_modules/luxon/build/es6/luxon.js +7217 -0
- package/dist/node_modules/cron/node_modules/luxon/build/global/luxon.js +7829 -0
- package/dist/node_modules/cron/node_modules/luxon/build/global/luxon.min.js +1 -0
- package/dist/node_modules/cron/node_modules/luxon/build/node/luxon.js +6932 -0
- package/dist/node_modules/cron/node_modules/luxon/package.json +85 -0
- package/dist/node_modules/cron/node_modules/luxon/src/datetime.js +2248 -0
- package/dist/node_modules/cron/node_modules/luxon/src/duration.js +948 -0
- package/dist/node_modules/cron/node_modules/luxon/src/errors.js +61 -0
- package/dist/node_modules/cron/node_modules/luxon/src/impl/conversions.js +161 -0
- package/dist/node_modules/cron/node_modules/luxon/src/impl/diff.js +75 -0
- package/dist/node_modules/cron/node_modules/luxon/src/impl/digits.js +75 -0
- package/dist/node_modules/cron/node_modules/luxon/src/impl/english.js +233 -0
- package/dist/node_modules/cron/node_modules/luxon/src/impl/formats.js +176 -0
- package/dist/node_modules/cron/node_modules/luxon/src/impl/formatter.js +400 -0
- package/dist/node_modules/cron/node_modules/luxon/src/impl/invalid.js +14 -0
- package/dist/node_modules/cron/node_modules/luxon/src/impl/locale.js +494 -0
- package/dist/node_modules/cron/node_modules/luxon/src/impl/regexParser.js +335 -0
- package/dist/node_modules/cron/node_modules/luxon/src/impl/tokenParser.js +444 -0
- package/dist/node_modules/cron/node_modules/luxon/src/impl/util.js +274 -0
- package/dist/node_modules/cron/node_modules/luxon/src/impl/zoneUtil.js +34 -0
- package/dist/node_modules/cron/node_modules/luxon/src/info.js +169 -0
- package/dist/node_modules/cron/node_modules/luxon/src/interval.js +637 -0
- package/dist/node_modules/cron/node_modules/luxon/src/luxon.js +26 -0
- package/dist/node_modules/cron/node_modules/luxon/src/package.json +4 -0
- package/dist/node_modules/cron/node_modules/luxon/src/settings.js +148 -0
- package/dist/node_modules/cron/node_modules/luxon/src/zone.js +91 -0
- package/dist/node_modules/cron/node_modules/luxon/src/zones/IANAZone.js +189 -0
- package/dist/node_modules/cron/node_modules/luxon/src/zones/fixedOffsetZone.js +102 -0
- package/dist/node_modules/cron/node_modules/luxon/src/zones/invalidZone.js +53 -0
- package/dist/node_modules/cron/node_modules/luxon/src/zones/systemZone.js +61 -0
- package/dist/node_modules/cron/package.json +1 -1
- package/dist/node_modules/cron/types/index.d.ts +181 -0
- package/dist/node_modules/cron/types/index.test-d.ts +85 -0
- package/dist/server/actions/authenticators.js +3 -0
- package/dist/server/basic-auth.js +5 -2
- package/dist/server/migrations/20231218132032-fix-allow-signup.d.ts +5 -0
- package/dist/server/migrations/20231218132032-fix-allow-signup.js +54 -0
- package/dist/server/model/authenticator.d.ts +5 -2
- package/dist/server/model/authenticator.js +2 -2
- package/package.json +2 -2
- package/dist/client/AuthPluginProvider.d.ts +0 -2
- package/dist/client/basic/SigninPage.d.ts +0 -6
- package/dist/client/basic/SignupPage.d.ts +0 -5
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import SystemZone from "./zones/systemZone.js";
|
|
2
|
+
import IANAZone from "./zones/IANAZone.js";
|
|
3
|
+
import Locale from "./impl/locale.js";
|
|
4
|
+
|
|
5
|
+
import { normalizeZone } from "./impl/zoneUtil.js";
|
|
6
|
+
|
|
7
|
+
let now = () => Date.now(),
|
|
8
|
+
defaultZone = "system",
|
|
9
|
+
defaultLocale = null,
|
|
10
|
+
defaultNumberingSystem = null,
|
|
11
|
+
defaultOutputCalendar = null,
|
|
12
|
+
twoDigitCutoffYear = 60,
|
|
13
|
+
throwOnInvalid;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.
|
|
17
|
+
*/
|
|
18
|
+
export default class Settings {
|
|
19
|
+
/**
|
|
20
|
+
* Get the callback for returning the current timestamp.
|
|
21
|
+
* @type {function}
|
|
22
|
+
*/
|
|
23
|
+
static get now() {
|
|
24
|
+
return now;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Set the callback for returning the current timestamp.
|
|
29
|
+
* The function should return a number, which will be interpreted as an Epoch millisecond count
|
|
30
|
+
* @type {function}
|
|
31
|
+
* @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future
|
|
32
|
+
* @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time
|
|
33
|
+
*/
|
|
34
|
+
static set now(n) {
|
|
35
|
+
now = n;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Set the default time zone to create DateTimes in. Does not affect existing instances.
|
|
40
|
+
* Use the value "system" to reset this value to the system's time zone.
|
|
41
|
+
* @type {string}
|
|
42
|
+
*/
|
|
43
|
+
static set defaultZone(zone) {
|
|
44
|
+
defaultZone = zone;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get the default time zone object currently used to create DateTimes. Does not affect existing instances.
|
|
49
|
+
* The default value is the system's time zone (the one set on the machine that runs this code).
|
|
50
|
+
* @type {Zone}
|
|
51
|
+
*/
|
|
52
|
+
static get defaultZone() {
|
|
53
|
+
return normalizeZone(defaultZone, SystemZone.instance);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get the default locale to create DateTimes with. Does not affect existing instances.
|
|
58
|
+
* @type {string}
|
|
59
|
+
*/
|
|
60
|
+
static get defaultLocale() {
|
|
61
|
+
return defaultLocale;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Set the default locale to create DateTimes with. Does not affect existing instances.
|
|
66
|
+
* @type {string}
|
|
67
|
+
*/
|
|
68
|
+
static set defaultLocale(locale) {
|
|
69
|
+
defaultLocale = locale;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Get the default numbering system to create DateTimes with. Does not affect existing instances.
|
|
74
|
+
* @type {string}
|
|
75
|
+
*/
|
|
76
|
+
static get defaultNumberingSystem() {
|
|
77
|
+
return defaultNumberingSystem;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Set the default numbering system to create DateTimes with. Does not affect existing instances.
|
|
82
|
+
* @type {string}
|
|
83
|
+
*/
|
|
84
|
+
static set defaultNumberingSystem(numberingSystem) {
|
|
85
|
+
defaultNumberingSystem = numberingSystem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Get the default output calendar to create DateTimes with. Does not affect existing instances.
|
|
90
|
+
* @type {string}
|
|
91
|
+
*/
|
|
92
|
+
static get defaultOutputCalendar() {
|
|
93
|
+
return defaultOutputCalendar;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Set the default output calendar to create DateTimes with. Does not affect existing instances.
|
|
98
|
+
* @type {string}
|
|
99
|
+
*/
|
|
100
|
+
static set defaultOutputCalendar(outputCalendar) {
|
|
101
|
+
defaultOutputCalendar = outputCalendar;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Get the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
|
|
106
|
+
* @type {number}
|
|
107
|
+
*/
|
|
108
|
+
static get twoDigitCutoffYear() {
|
|
109
|
+
return twoDigitCutoffYear;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Set the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
|
|
114
|
+
* @type {number}
|
|
115
|
+
* @example Settings.twoDigitCutoffYear = 0 // cut-off year is 0, so all 'yy' are interpretted as current century
|
|
116
|
+
* @example Settings.twoDigitCutoffYear = 50 // '49' -> 1949; '50' -> 2050
|
|
117
|
+
* @example Settings.twoDigitCutoffYear = 1950 // interpretted as 50
|
|
118
|
+
* @example Settings.twoDigitCutoffYear = 2050 // ALSO interpretted as 50
|
|
119
|
+
*/
|
|
120
|
+
static set twoDigitCutoffYear(cutoffYear) {
|
|
121
|
+
twoDigitCutoffYear = cutoffYear % 100;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
|
|
126
|
+
* @type {boolean}
|
|
127
|
+
*/
|
|
128
|
+
static get throwOnInvalid() {
|
|
129
|
+
return throwOnInvalid;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
|
|
134
|
+
* @type {boolean}
|
|
135
|
+
*/
|
|
136
|
+
static set throwOnInvalid(t) {
|
|
137
|
+
throwOnInvalid = t;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Reset Luxon's global caches. Should only be necessary in testing scenarios.
|
|
142
|
+
* @return {void}
|
|
143
|
+
*/
|
|
144
|
+
static resetCaches() {
|
|
145
|
+
Locale.resetCache();
|
|
146
|
+
IANAZone.resetCache();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ZoneIsAbstractError } from "./errors.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @interface
|
|
5
|
+
*/
|
|
6
|
+
export default class Zone {
|
|
7
|
+
/**
|
|
8
|
+
* The type of zone
|
|
9
|
+
* @abstract
|
|
10
|
+
* @type {string}
|
|
11
|
+
*/
|
|
12
|
+
get type() {
|
|
13
|
+
throw new ZoneIsAbstractError();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The name of this zone.
|
|
18
|
+
* @abstract
|
|
19
|
+
* @type {string}
|
|
20
|
+
*/
|
|
21
|
+
get name() {
|
|
22
|
+
throw new ZoneIsAbstractError();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get ianaName() {
|
|
26
|
+
return this.name;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns whether the offset is known to be fixed for the whole year.
|
|
31
|
+
* @abstract
|
|
32
|
+
* @type {boolean}
|
|
33
|
+
*/
|
|
34
|
+
get isUniversal() {
|
|
35
|
+
throw new ZoneIsAbstractError();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Returns the offset's common name (such as EST) at the specified timestamp
|
|
40
|
+
* @abstract
|
|
41
|
+
* @param {number} ts - Epoch milliseconds for which to get the name
|
|
42
|
+
* @param {Object} opts - Options to affect the format
|
|
43
|
+
* @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
|
|
44
|
+
* @param {string} opts.locale - What locale to return the offset name in.
|
|
45
|
+
* @return {string}
|
|
46
|
+
*/
|
|
47
|
+
offsetName(ts, opts) {
|
|
48
|
+
throw new ZoneIsAbstractError();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Returns the offset's value as a string
|
|
53
|
+
* @abstract
|
|
54
|
+
* @param {number} ts - Epoch milliseconds for which to get the offset
|
|
55
|
+
* @param {string} format - What style of offset to return.
|
|
56
|
+
* Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
|
|
57
|
+
* @return {string}
|
|
58
|
+
*/
|
|
59
|
+
formatOffset(ts, format) {
|
|
60
|
+
throw new ZoneIsAbstractError();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Return the offset in minutes for this zone at the specified timestamp.
|
|
65
|
+
* @abstract
|
|
66
|
+
* @param {number} ts - Epoch milliseconds for which to compute the offset
|
|
67
|
+
* @return {number}
|
|
68
|
+
*/
|
|
69
|
+
offset(ts) {
|
|
70
|
+
throw new ZoneIsAbstractError();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Return whether this Zone is equal to another zone
|
|
75
|
+
* @abstract
|
|
76
|
+
* @param {Zone} otherZone - the zone to compare
|
|
77
|
+
* @return {boolean}
|
|
78
|
+
*/
|
|
79
|
+
equals(otherZone) {
|
|
80
|
+
throw new ZoneIsAbstractError();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Return whether this Zone is valid.
|
|
85
|
+
* @abstract
|
|
86
|
+
* @type {boolean}
|
|
87
|
+
*/
|
|
88
|
+
get isValid() {
|
|
89
|
+
throw new ZoneIsAbstractError();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { formatOffset, parseZoneInfo, isUndefined, objToLocalTS } from "../impl/util.js";
|
|
2
|
+
import Zone from "../zone.js";
|
|
3
|
+
|
|
4
|
+
let dtfCache = {};
|
|
5
|
+
function makeDTF(zone) {
|
|
6
|
+
if (!dtfCache[zone]) {
|
|
7
|
+
dtfCache[zone] = new Intl.DateTimeFormat("en-US", {
|
|
8
|
+
hour12: false,
|
|
9
|
+
timeZone: zone,
|
|
10
|
+
year: "numeric",
|
|
11
|
+
month: "2-digit",
|
|
12
|
+
day: "2-digit",
|
|
13
|
+
hour: "2-digit",
|
|
14
|
+
minute: "2-digit",
|
|
15
|
+
second: "2-digit",
|
|
16
|
+
era: "short",
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return dtfCache[zone];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const typeToPos = {
|
|
23
|
+
year: 0,
|
|
24
|
+
month: 1,
|
|
25
|
+
day: 2,
|
|
26
|
+
era: 3,
|
|
27
|
+
hour: 4,
|
|
28
|
+
minute: 5,
|
|
29
|
+
second: 6,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function hackyOffset(dtf, date) {
|
|
33
|
+
const formatted = dtf.format(date).replace(/\u200E/g, ""),
|
|
34
|
+
parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted),
|
|
35
|
+
[, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed;
|
|
36
|
+
return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function partsOffset(dtf, date) {
|
|
40
|
+
const formatted = dtf.formatToParts(date);
|
|
41
|
+
const filled = [];
|
|
42
|
+
for (let i = 0; i < formatted.length; i++) {
|
|
43
|
+
const { type, value } = formatted[i];
|
|
44
|
+
const pos = typeToPos[type];
|
|
45
|
+
|
|
46
|
+
if (type === "era") {
|
|
47
|
+
filled[pos] = value;
|
|
48
|
+
} else if (!isUndefined(pos)) {
|
|
49
|
+
filled[pos] = parseInt(value, 10);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return filled;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let ianaZoneCache = {};
|
|
56
|
+
/**
|
|
57
|
+
* A zone identified by an IANA identifier, like America/New_York
|
|
58
|
+
* @implements {Zone}
|
|
59
|
+
*/
|
|
60
|
+
export default class IANAZone extends Zone {
|
|
61
|
+
/**
|
|
62
|
+
* @param {string} name - Zone name
|
|
63
|
+
* @return {IANAZone}
|
|
64
|
+
*/
|
|
65
|
+
static create(name) {
|
|
66
|
+
if (!ianaZoneCache[name]) {
|
|
67
|
+
ianaZoneCache[name] = new IANAZone(name);
|
|
68
|
+
}
|
|
69
|
+
return ianaZoneCache[name];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Reset local caches. Should only be necessary in testing scenarios.
|
|
74
|
+
* @return {void}
|
|
75
|
+
*/
|
|
76
|
+
static resetCache() {
|
|
77
|
+
ianaZoneCache = {};
|
|
78
|
+
dtfCache = {};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.
|
|
83
|
+
* @param {string} s - The string to check validity on
|
|
84
|
+
* @example IANAZone.isValidSpecifier("America/New_York") //=> true
|
|
85
|
+
* @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false
|
|
86
|
+
* @deprecated This method returns false for some valid IANA names. Use isValidZone instead.
|
|
87
|
+
* @return {boolean}
|
|
88
|
+
*/
|
|
89
|
+
static isValidSpecifier(s) {
|
|
90
|
+
return this.isValidZone(s);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Returns whether the provided string identifies a real zone
|
|
95
|
+
* @param {string} zone - The string to check
|
|
96
|
+
* @example IANAZone.isValidZone("America/New_York") //=> true
|
|
97
|
+
* @example IANAZone.isValidZone("Fantasia/Castle") //=> false
|
|
98
|
+
* @example IANAZone.isValidZone("Sport~~blorp") //=> false
|
|
99
|
+
* @return {boolean}
|
|
100
|
+
*/
|
|
101
|
+
static isValidZone(zone) {
|
|
102
|
+
if (!zone) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
new Intl.DateTimeFormat("en-US", { timeZone: zone }).format();
|
|
107
|
+
return true;
|
|
108
|
+
} catch (e) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
constructor(name) {
|
|
114
|
+
super();
|
|
115
|
+
/** @private **/
|
|
116
|
+
this.zoneName = name;
|
|
117
|
+
/** @private **/
|
|
118
|
+
this.valid = IANAZone.isValidZone(name);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** @override **/
|
|
122
|
+
get type() {
|
|
123
|
+
return "iana";
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** @override **/
|
|
127
|
+
get name() {
|
|
128
|
+
return this.zoneName;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** @override **/
|
|
132
|
+
get isUniversal() {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** @override **/
|
|
137
|
+
offsetName(ts, { format, locale }) {
|
|
138
|
+
return parseZoneInfo(ts, format, locale, this.name);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** @override **/
|
|
142
|
+
formatOffset(ts, format) {
|
|
143
|
+
return formatOffset(this.offset(ts), format);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** @override **/
|
|
147
|
+
offset(ts) {
|
|
148
|
+
const date = new Date(ts);
|
|
149
|
+
|
|
150
|
+
if (isNaN(date)) return NaN;
|
|
151
|
+
|
|
152
|
+
const dtf = makeDTF(this.name);
|
|
153
|
+
let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts
|
|
154
|
+
? partsOffset(dtf, date)
|
|
155
|
+
: hackyOffset(dtf, date);
|
|
156
|
+
|
|
157
|
+
if (adOrBc === "BC") {
|
|
158
|
+
year = -Math.abs(year) + 1;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat
|
|
162
|
+
const adjustedHour = hour === 24 ? 0 : hour;
|
|
163
|
+
|
|
164
|
+
const asUTC = objToLocalTS({
|
|
165
|
+
year,
|
|
166
|
+
month,
|
|
167
|
+
day,
|
|
168
|
+
hour: adjustedHour,
|
|
169
|
+
minute,
|
|
170
|
+
second,
|
|
171
|
+
millisecond: 0,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
let asTS = +date;
|
|
175
|
+
const over = asTS % 1000;
|
|
176
|
+
asTS -= over >= 0 ? over : 1000 + over;
|
|
177
|
+
return (asUTC - asTS) / (60 * 1000);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** @override **/
|
|
181
|
+
equals(otherZone) {
|
|
182
|
+
return otherZone.type === "iana" && otherZone.name === this.name;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** @override **/
|
|
186
|
+
get isValid() {
|
|
187
|
+
return this.valid;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { formatOffset, signedOffset } from "../impl/util.js";
|
|
2
|
+
import Zone from "../zone.js";
|
|
3
|
+
|
|
4
|
+
let singleton = null;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A zone with a fixed offset (meaning no DST)
|
|
8
|
+
* @implements {Zone}
|
|
9
|
+
*/
|
|
10
|
+
export default class FixedOffsetZone extends Zone {
|
|
11
|
+
/**
|
|
12
|
+
* Get a singleton instance of UTC
|
|
13
|
+
* @return {FixedOffsetZone}
|
|
14
|
+
*/
|
|
15
|
+
static get utcInstance() {
|
|
16
|
+
if (singleton === null) {
|
|
17
|
+
singleton = new FixedOffsetZone(0);
|
|
18
|
+
}
|
|
19
|
+
return singleton;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get an instance with a specified offset
|
|
24
|
+
* @param {number} offset - The offset in minutes
|
|
25
|
+
* @return {FixedOffsetZone}
|
|
26
|
+
*/
|
|
27
|
+
static instance(offset) {
|
|
28
|
+
return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6"
|
|
33
|
+
* @param {string} s - The offset string to parse
|
|
34
|
+
* @example FixedOffsetZone.parseSpecifier("UTC+6")
|
|
35
|
+
* @example FixedOffsetZone.parseSpecifier("UTC+06")
|
|
36
|
+
* @example FixedOffsetZone.parseSpecifier("UTC-6:00")
|
|
37
|
+
* @return {FixedOffsetZone}
|
|
38
|
+
*/
|
|
39
|
+
static parseSpecifier(s) {
|
|
40
|
+
if (s) {
|
|
41
|
+
const r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
|
|
42
|
+
if (r) {
|
|
43
|
+
return new FixedOffsetZone(signedOffset(r[1], r[2]));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
constructor(offset) {
|
|
50
|
+
super();
|
|
51
|
+
/** @private **/
|
|
52
|
+
this.fixed = offset;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** @override **/
|
|
56
|
+
get type() {
|
|
57
|
+
return "fixed";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** @override **/
|
|
61
|
+
get name() {
|
|
62
|
+
return this.fixed === 0 ? "UTC" : `UTC${formatOffset(this.fixed, "narrow")}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get ianaName() {
|
|
66
|
+
if (this.fixed === 0) {
|
|
67
|
+
return "Etc/UTC";
|
|
68
|
+
} else {
|
|
69
|
+
return `Etc/GMT${formatOffset(-this.fixed, "narrow")}`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** @override **/
|
|
74
|
+
offsetName() {
|
|
75
|
+
return this.name;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** @override **/
|
|
79
|
+
formatOffset(ts, format) {
|
|
80
|
+
return formatOffset(this.fixed, format);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** @override **/
|
|
84
|
+
get isUniversal() {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** @override **/
|
|
89
|
+
offset() {
|
|
90
|
+
return this.fixed;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** @override **/
|
|
94
|
+
equals(otherZone) {
|
|
95
|
+
return otherZone.type === "fixed" && otherZone.fixed === this.fixed;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** @override **/
|
|
99
|
+
get isValid() {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Zone from "../zone.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A zone that failed to parse. You should never need to instantiate this.
|
|
5
|
+
* @implements {Zone}
|
|
6
|
+
*/
|
|
7
|
+
export default class InvalidZone extends Zone {
|
|
8
|
+
constructor(zoneName) {
|
|
9
|
+
super();
|
|
10
|
+
/** @private */
|
|
11
|
+
this.zoneName = zoneName;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** @override **/
|
|
15
|
+
get type() {
|
|
16
|
+
return "invalid";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** @override **/
|
|
20
|
+
get name() {
|
|
21
|
+
return this.zoneName;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** @override **/
|
|
25
|
+
get isUniversal() {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** @override **/
|
|
30
|
+
offsetName() {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** @override **/
|
|
35
|
+
formatOffset() {
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** @override **/
|
|
40
|
+
offset() {
|
|
41
|
+
return NaN;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** @override **/
|
|
45
|
+
equals() {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @override **/
|
|
50
|
+
get isValid() {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { formatOffset, parseZoneInfo } from "../impl/util.js";
|
|
2
|
+
import Zone from "../zone.js";
|
|
3
|
+
|
|
4
|
+
let singleton = null;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the local zone for this JavaScript environment.
|
|
8
|
+
* @implements {Zone}
|
|
9
|
+
*/
|
|
10
|
+
export default class SystemZone extends Zone {
|
|
11
|
+
/**
|
|
12
|
+
* Get a singleton instance of the local zone
|
|
13
|
+
* @return {SystemZone}
|
|
14
|
+
*/
|
|
15
|
+
static get instance() {
|
|
16
|
+
if (singleton === null) {
|
|
17
|
+
singleton = new SystemZone();
|
|
18
|
+
}
|
|
19
|
+
return singleton;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** @override **/
|
|
23
|
+
get type() {
|
|
24
|
+
return "system";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** @override **/
|
|
28
|
+
get name() {
|
|
29
|
+
return new Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** @override **/
|
|
33
|
+
get isUniversal() {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** @override **/
|
|
38
|
+
offsetName(ts, { format, locale }) {
|
|
39
|
+
return parseZoneInfo(ts, format, locale);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** @override **/
|
|
43
|
+
formatOffset(ts, format) {
|
|
44
|
+
return formatOffset(this.offset(ts), format);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** @override **/
|
|
48
|
+
offset(ts) {
|
|
49
|
+
return -new Date(ts).getTimezoneOffset();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** @override **/
|
|
53
|
+
equals(otherZone) {
|
|
54
|
+
return otherZone.type === "system";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** @override **/
|
|
58
|
+
get isValid() {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cron","description":"Cron jobs for your node","version":"2.
|
|
1
|
+
{"name":"cron","description":"Cron jobs for your node","version":"2.4.4","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage","test:types":"tsd","prepare":"husky install","release":"semantic-release"},"types":"types/index.d.ts","dependencies":{"@types/luxon":"~3.3.0","luxon":"~3.3.0"},"devDependencies":{"@commitlint/cli":"~17.6.6","@insurgentlab/commitlint-config":"^18.1.0","@insurgentlab/conventional-changelog-preset":"~6.0.3","@semantic-release/changelog":"~6.0.x","@semantic-release/commit-analyzer":"~9.0.x","@semantic-release/git":"~10.0.x","@semantic-release/github":"~8.1.x","@semantic-release/npm":"~10.0.x","@semantic-release/release-notes-generator":"~11.0.x","chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","husky":"^8.0.3","jest":"~29.5.x","prettier":"~2.8.x","semantic-release":"~21.0.x","sinon":"^15.0.x","tsd":"^0.28.1"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","types","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2023-12-25T14:41:48.290Z"}
|