croner 3.0.40 → 3.0.44
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 +211 -211
- package/dist/croner.min.js +1 -1
- package/dist/croner.min.mjs +1 -1
- package/dist-legacy/croner.cjs +1 -1
- package/package.json +1 -1
- package/src/croner.js +84 -455
- package/src/date.js +214 -0
- package/src/pattern.js +202 -0
- package/src/timezone.js +12 -0
- package/test/{suite.cjs → src/suite.cjs} +3 -1
- package/test/test.croner.js +30 -0
- package/test/test.dist.legacy.cjs +1 -1
- package/test/test.dist.module.js +1 -1
- package/types/croner.d.ts +28 -45
- package/types/date.d.ts +54 -0
- package/types/pattern.d.ts +43 -0
- package/types/timezone.d.ts +9 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type CronPatternPart = "seconds" | "minutes" | "hours" | "days" | "months" | "daysOfWeek";
|
|
2
|
+
export type CronIndexOffset = 0 | -1;
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {"seconds" | "minutes" | "hours" | "days" | "months" | "daysOfWeek"} CronPatternPart
|
|
5
|
+
* @typedef {0 | -1} CronIndexOffset
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Create a CronPattern instance from pattern string ('* * * * * *')
|
|
9
|
+
* @constructor
|
|
10
|
+
* @param {string} pattern - Input pattern
|
|
11
|
+
*/
|
|
12
|
+
export function CronPattern(pattern: string): void;
|
|
13
|
+
export class CronPattern {
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {"seconds" | "minutes" | "hours" | "days" | "months" | "daysOfWeek"} CronPatternPart
|
|
16
|
+
* @typedef {0 | -1} CronIndexOffset
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Create a CronPattern instance from pattern string ('* * * * * *')
|
|
20
|
+
* @constructor
|
|
21
|
+
* @param {string} pattern - Input pattern
|
|
22
|
+
*/
|
|
23
|
+
constructor(pattern: string);
|
|
24
|
+
pattern: string;
|
|
25
|
+
seconds: any[];
|
|
26
|
+
minutes: any[];
|
|
27
|
+
hours: any[];
|
|
28
|
+
days: any[];
|
|
29
|
+
months: any[];
|
|
30
|
+
daysOfWeek: any[];
|
|
31
|
+
/**
|
|
32
|
+
* Parse current pattern, will raise an error on failure
|
|
33
|
+
*/
|
|
34
|
+
parse(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Convert current part (seconds/minutes etc) to an array of 1 or 0 depending on if the part is about to trigger a run or not.
|
|
37
|
+
*
|
|
38
|
+
* @param {CronPatternPart} type - Seconds/minutes etc
|
|
39
|
+
* @param {string} conf - Current pattern part - *, 0-1 etc
|
|
40
|
+
* @param {CronIndexOffset} valueIndexOffset - 0 or -1. 0 for seconds,minutes, hours as they start on 1. -1 on days and months, as the start on 0
|
|
41
|
+
*/
|
|
42
|
+
partToArray(type: CronPatternPart, conf: string, valueIndexOffset: CronIndexOffset): void;
|
|
43
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default convertTZ;
|
|
2
|
+
/**
|
|
3
|
+
* Converts a date to a specific time zone
|
|
4
|
+
*
|
|
5
|
+
* @param {date} date - Input date
|
|
6
|
+
* @param {string} tzString - Timezone string in Europe/Stockholm format
|
|
7
|
+
* @returns {date}
|
|
8
|
+
*/
|
|
9
|
+
declare function convertTZ(date: any, tzString: string): any;
|