cronstrue 3.0.0 → 3.2.0
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 +28 -27
- package/dist/cronstrue-i18n.js +197 -2
- package/dist/cronstrue-i18n.min.js +1 -1
- package/dist/i18n/allLocales.d.ts +1 -0
- package/dist/i18n/locales/hr.d.ts +55 -0
- package/locales/hr.js +288 -0
- package/locales/hr.min.js +1 -0
- package/locales/ru.js +1 -1
- package/locales/ru.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ This library was ported from the original C# implementation called [cron-express
|
|
|
17
17
|
- Supports all cron expression special characters including * / , - ? L W, #
|
|
18
18
|
- Supports 5, 6 (w/ seconds or year), or 7 (w/ seconds and year) part cron expressions
|
|
19
19
|
- [Quartz Job Scheduler](http://www.quartz-scheduler.org/) cron expressions are supported
|
|
20
|
-
- Supports time specification _nicknames_ (@yearly, @annually, @monthly, @weekly, @daily
|
|
20
|
+
- Supports time specification _nicknames_ (@yearly, @annually, @monthly, @weekly, @daily)
|
|
21
21
|
- i18n support with 30+ languages
|
|
22
22
|
|
|
23
23
|
## Demo
|
|
@@ -172,32 +172,6 @@ cronstrue.toString("*/5 * * * *", { locale: "fr" }); // => Toutes les 5 minutes
|
|
|
172
172
|
cronstrue.toString("*/5 * * * *", { locale: "es" }); // => Cada 5 minutos
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
## Frequently Asked Questions
|
|
176
|
-
|
|
177
|
-
1. The cron expression I am passing in is not valid and this library is giving strange output. What should I do?
|
|
178
|
-
|
|
179
|
-
This library does not do full validation of cron expressions and assumes the expression passed in is valid. If you need to validate an expression consider using a library like [cron-parser](https://www.npmjs.com/package/cron-parser). Example validation with cron-parser:
|
|
180
|
-
|
|
181
|
-
```
|
|
182
|
-
const cronParser = require("cron-parser");
|
|
183
|
-
const cronstrue = require("cronstrue");
|
|
184
|
-
|
|
185
|
-
const expression = "* * * * * *";
|
|
186
|
-
|
|
187
|
-
// Validate expression first
|
|
188
|
-
let isCronValid = true;
|
|
189
|
-
try { cronParser.parseExpression(expression) } catch(e) { isCronValid = false; }
|
|
190
|
-
|
|
191
|
-
// If valid, then pass into cRonstrue
|
|
192
|
-
if (isCronValid) {
|
|
193
|
-
console.log(cronstrue.toString("* * * * *"));
|
|
194
|
-
}
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
2. Can cRonstrue output the next occurrence of the cron expression?
|
|
198
|
-
|
|
199
|
-
No, cRonstrue does not support this. This library simply describes a cron expression that is passed in.
|
|
200
|
-
|
|
201
175
|
### Supported Locales
|
|
202
176
|
|
|
203
177
|
The following locales can be passed in for the `locale` option. Thank you to the author (shown below) of each translation!
|
|
@@ -208,6 +182,7 @@ The following locales can be passed in for the `locale` option. Thank you to th
|
|
|
208
182
|
- be - Belarusian ([Kirill Mikulich](https://github.com/KirillMikulich))
|
|
209
183
|
- bg - Bulgarian ([kamenf](https://github.com/kamenf))
|
|
210
184
|
- ca - Catalan ([Francisco Javier Barrena](https://github.com/fjbarrena))
|
|
185
|
+
- hr - Croatian ([Rok Šekoranja](https://github.com/Rookxc))
|
|
211
186
|
- cs - Czech ([hanbar](https://github.com/hanbar))
|
|
212
187
|
- es - Spanish ([Ivan Santos](https://github.com/ivansg))
|
|
213
188
|
- da - Danish ([Rasmus Melchior Jacobsen](https://github.com/rmja))
|
|
@@ -240,6 +215,32 @@ The following locales can be passed in for the `locale` option. Thank you to th
|
|
|
240
215
|
- zh_CN - Chinese (Simplified) ([Star Peng](https://github.com/starpeng))
|
|
241
216
|
- zh_TW - Chinese (Traditional) ([Ricky Chiang](https://github.com/metavige))
|
|
242
217
|
|
|
218
|
+
## Frequently Asked Questions
|
|
219
|
+
|
|
220
|
+
1. The cron expression I am passing in is not valid and this library is giving strange output. What should I do?
|
|
221
|
+
|
|
222
|
+
This library does not do full validation of cron expressions and assumes the expression passed in is valid. If you need to validate an expression consider using a library like [cron-parser](https://www.npmjs.com/package/cron-parser). Example validation with cron-parser:
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
const cronParser = require("cron-parser");
|
|
226
|
+
const cronstrue = require("cronstrue");
|
|
227
|
+
|
|
228
|
+
const expression = "* * * * * *";
|
|
229
|
+
|
|
230
|
+
// Validate expression first
|
|
231
|
+
let isCronValid = true;
|
|
232
|
+
try { cronParser.parseExpression(expression) } catch(e) { isCronValid = false; }
|
|
233
|
+
|
|
234
|
+
// If valid, then pass into cRonstrue
|
|
235
|
+
if (isCronValid) {
|
|
236
|
+
console.log(cronstrue.toString("* * * * *"));
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
2. Can cRonstrue output the next occurrence of the cron expression?
|
|
241
|
+
|
|
242
|
+
No, cRonstrue does not support this. This library simply describes a cron expression that is passed in.
|
|
243
|
+
|
|
243
244
|
## Sponsors
|
|
244
245
|
|
|
245
246
|
Thank you to the following sponsors of this project!
|
package/dist/cronstrue-i18n.js
CHANGED
|
@@ -769,7 +769,7 @@ exports.ExpressionDescriptor = ExpressionDescriptor;
|
|
|
769
769
|
|
|
770
770
|
|
|
771
771
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
772
|
-
exports.bg = exports.my = exports.vi = exports.ar = exports.th = exports.af = exports.hu = exports.be = exports.ca = exports.fa = exports.sw = exports.sl = exports.fi = exports.sk = exports.cs = exports.he = exports.ja = exports.zh_TW = exports.zh_CN = exports.uk = exports.tr = exports.ru = exports.ro = exports.pt_PT = exports.pt_BR = exports.pl = exports.sv = exports.nb = exports.nl = exports.ko = exports.id = exports.it = exports.fr = exports.es = exports.de = exports.da = exports.en = void 0;
|
|
772
|
+
exports.hr = exports.bg = exports.my = exports.vi = exports.ar = exports.th = exports.af = exports.hu = exports.be = exports.ca = exports.fa = exports.sw = exports.sl = exports.fi = exports.sk = exports.cs = exports.he = exports.ja = exports.zh_TW = exports.zh_CN = exports.uk = exports.tr = exports.ru = exports.ro = exports.pt_PT = exports.pt_BR = exports.pl = exports.sv = exports.nb = exports.nl = exports.ko = exports.id = exports.it = exports.fr = exports.es = exports.de = exports.da = exports.en = void 0;
|
|
773
773
|
var en_1 = __webpack_require__(486);
|
|
774
774
|
Object.defineProperty(exports, "en", ({ enumerable: true, get: function () { return en_1.en; } }));
|
|
775
775
|
var da_1 = __webpack_require__(506);
|
|
@@ -844,6 +844,8 @@ var my_1 = __webpack_require__(919);
|
|
|
844
844
|
Object.defineProperty(exports, "my", ({ enumerable: true, get: function () { return my_1.my; } }));
|
|
845
845
|
var bg_1 = __webpack_require__(622);
|
|
846
846
|
Object.defineProperty(exports, "bg", ({ enumerable: true, get: function () { return bg_1.bg; } }));
|
|
847
|
+
var hr_1 = __webpack_require__(131);
|
|
848
|
+
Object.defineProperty(exports, "hr", ({ enumerable: true, get: function () { return hr_1.hr; } }));
|
|
847
849
|
|
|
848
850
|
|
|
849
851
|
/***/ }),
|
|
@@ -3478,6 +3480,199 @@ var he = (function () {
|
|
|
3478
3480
|
exports.he = he;
|
|
3479
3481
|
|
|
3480
3482
|
|
|
3483
|
+
/***/ }),
|
|
3484
|
+
|
|
3485
|
+
/***/ 131:
|
|
3486
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3487
|
+
|
|
3488
|
+
|
|
3489
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3490
|
+
exports.hr = void 0;
|
|
3491
|
+
var hr = (function () {
|
|
3492
|
+
function hr() {
|
|
3493
|
+
}
|
|
3494
|
+
hr.prototype.use24HourTimeFormatByDefault = function () {
|
|
3495
|
+
return true;
|
|
3496
|
+
};
|
|
3497
|
+
hr.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
|
|
3498
|
+
return "Došlo je do pogreške pri generiranju izraza. Provjerite sintaksu cron izraza.";
|
|
3499
|
+
};
|
|
3500
|
+
hr.prototype.at = function () {
|
|
3501
|
+
return "U";
|
|
3502
|
+
};
|
|
3503
|
+
hr.prototype.atSpace = function () {
|
|
3504
|
+
return "U ";
|
|
3505
|
+
};
|
|
3506
|
+
hr.prototype.atX0 = function () {
|
|
3507
|
+
return "u %s";
|
|
3508
|
+
};
|
|
3509
|
+
hr.prototype.atX0MinutesPastTheHour = function () {
|
|
3510
|
+
return "u %s minuta nakon punog sata";
|
|
3511
|
+
};
|
|
3512
|
+
hr.prototype.atX0SecondsPastTheMinute = function () {
|
|
3513
|
+
return "u %s sekundi nakon pune minute";
|
|
3514
|
+
};
|
|
3515
|
+
hr.prototype.betweenX0AndX1 = function () {
|
|
3516
|
+
return "između %s i %s";
|
|
3517
|
+
};
|
|
3518
|
+
hr.prototype.commaBetweenDayX0AndX1OfTheMonth = function () {
|
|
3519
|
+
return ", između %s. i %s. dana u mjesecu";
|
|
3520
|
+
};
|
|
3521
|
+
hr.prototype.commaEveryDay = function () {
|
|
3522
|
+
return ", svaki dan";
|
|
3523
|
+
};
|
|
3524
|
+
hr.prototype.commaEveryX0Days = function () {
|
|
3525
|
+
return ", svakih %s dana";
|
|
3526
|
+
};
|
|
3527
|
+
hr.prototype.commaEveryX0DaysOfTheWeek = function () {
|
|
3528
|
+
return ", svakih %s dana u tjednu";
|
|
3529
|
+
};
|
|
3530
|
+
hr.prototype.commaEveryX0Months = function () {
|
|
3531
|
+
return ", svakih %s mjeseci";
|
|
3532
|
+
};
|
|
3533
|
+
hr.prototype.commaEveryX0Years = function () {
|
|
3534
|
+
return ", svakih %s godina";
|
|
3535
|
+
};
|
|
3536
|
+
hr.prototype.commaOnDayX0OfTheMonth = function () {
|
|
3537
|
+
return ", %s. dan u mjesecu";
|
|
3538
|
+
};
|
|
3539
|
+
hr.prototype.commaOnlyInX0 = function () {
|
|
3540
|
+
return ", samo u %s";
|
|
3541
|
+
};
|
|
3542
|
+
hr.prototype.commaOnlyOnX0 = function () {
|
|
3543
|
+
return ", samo %s";
|
|
3544
|
+
};
|
|
3545
|
+
hr.prototype.commaAndOnX0 = function () {
|
|
3546
|
+
return ", i %s";
|
|
3547
|
+
};
|
|
3548
|
+
hr.prototype.commaOnThe = function () {
|
|
3549
|
+
return ", ";
|
|
3550
|
+
};
|
|
3551
|
+
hr.prototype.commaOnTheLastDayOfTheMonth = function () {
|
|
3552
|
+
return ", zadnji dan u mjesecu";
|
|
3553
|
+
};
|
|
3554
|
+
hr.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
|
|
3555
|
+
return ", zadnji radni dan u mjesecu";
|
|
3556
|
+
};
|
|
3557
|
+
hr.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
|
|
3558
|
+
return ", %s dana prije kraja mjeseca";
|
|
3559
|
+
};
|
|
3560
|
+
hr.prototype.commaOnTheLastX0OfTheMonth = function () {
|
|
3561
|
+
return ", zadnji %s u mjesecu";
|
|
3562
|
+
};
|
|
3563
|
+
hr.prototype.commaOnTheX0OfTheMonth = function () {
|
|
3564
|
+
return ", %s u mjesecu";
|
|
3565
|
+
};
|
|
3566
|
+
hr.prototype.commaX0ThroughX1 = function () {
|
|
3567
|
+
return ", od %s do %s";
|
|
3568
|
+
};
|
|
3569
|
+
hr.prototype.commaAndX0ThroughX1 = function () {
|
|
3570
|
+
return ", i od %s do %s";
|
|
3571
|
+
};
|
|
3572
|
+
hr.prototype.everyHour = function () {
|
|
3573
|
+
return "svaki sat";
|
|
3574
|
+
};
|
|
3575
|
+
hr.prototype.everyMinute = function () {
|
|
3576
|
+
return "svaku minutu";
|
|
3577
|
+
};
|
|
3578
|
+
hr.prototype.everyMinuteBetweenX0AndX1 = function () {
|
|
3579
|
+
return "Svaku minutu između %s i %s";
|
|
3580
|
+
};
|
|
3581
|
+
hr.prototype.everySecond = function () {
|
|
3582
|
+
return "svaku sekundu";
|
|
3583
|
+
};
|
|
3584
|
+
hr.prototype.everyX0Hours = function () {
|
|
3585
|
+
return "svakih %s sati";
|
|
3586
|
+
};
|
|
3587
|
+
hr.prototype.everyX0Minutes = function () {
|
|
3588
|
+
return "svakih %s minuta";
|
|
3589
|
+
};
|
|
3590
|
+
hr.prototype.everyX0Seconds = function () {
|
|
3591
|
+
return "svakih %s sekundi";
|
|
3592
|
+
};
|
|
3593
|
+
hr.prototype.fifth = function () {
|
|
3594
|
+
return "peti";
|
|
3595
|
+
};
|
|
3596
|
+
hr.prototype.first = function () {
|
|
3597
|
+
return "prvi";
|
|
3598
|
+
};
|
|
3599
|
+
hr.prototype.firstWeekday = function () {
|
|
3600
|
+
return "prvi radni dan";
|
|
3601
|
+
};
|
|
3602
|
+
hr.prototype.fourth = function () {
|
|
3603
|
+
return "četvrti";
|
|
3604
|
+
};
|
|
3605
|
+
hr.prototype.minutesX0ThroughX1PastTheHour = function () {
|
|
3606
|
+
return "minute od %s do %s nakon punog sata";
|
|
3607
|
+
};
|
|
3608
|
+
hr.prototype.second = function () {
|
|
3609
|
+
return "drugi";
|
|
3610
|
+
};
|
|
3611
|
+
hr.prototype.secondsX0ThroughX1PastTheMinute = function () {
|
|
3612
|
+
return "sekunde od %s do %s nakon pune minute";
|
|
3613
|
+
};
|
|
3614
|
+
hr.prototype.spaceAnd = function () {
|
|
3615
|
+
return " i";
|
|
3616
|
+
};
|
|
3617
|
+
hr.prototype.spaceX0OfTheMonth = function () {
|
|
3618
|
+
return " %s u mjesecu";
|
|
3619
|
+
};
|
|
3620
|
+
hr.prototype.lastDay = function () {
|
|
3621
|
+
return "zadnji dan";
|
|
3622
|
+
};
|
|
3623
|
+
hr.prototype.third = function () {
|
|
3624
|
+
return "treći";
|
|
3625
|
+
};
|
|
3626
|
+
hr.prototype.weekdayNearestDayX0 = function () {
|
|
3627
|
+
return "radni dan najbliži %s. danu";
|
|
3628
|
+
};
|
|
3629
|
+
hr.prototype.commaMonthX0ThroughMonthX1 = function () {
|
|
3630
|
+
return null;
|
|
3631
|
+
};
|
|
3632
|
+
hr.prototype.commaYearX0ThroughYearX1 = function () {
|
|
3633
|
+
return null;
|
|
3634
|
+
};
|
|
3635
|
+
hr.prototype.atX0MinutesPastTheHourGt20 = function () {
|
|
3636
|
+
return null;
|
|
3637
|
+
};
|
|
3638
|
+
hr.prototype.atX0SecondsPastTheMinuteGt20 = function () {
|
|
3639
|
+
return null;
|
|
3640
|
+
};
|
|
3641
|
+
hr.prototype.commaStartingX0 = function () {
|
|
3642
|
+
return ", počevši od %s";
|
|
3643
|
+
};
|
|
3644
|
+
hr.prototype.daysOfTheWeek = function () {
|
|
3645
|
+
return [
|
|
3646
|
+
"Nedjelja",
|
|
3647
|
+
"Ponedjeljak",
|
|
3648
|
+
"Utorak",
|
|
3649
|
+
"Srijeda",
|
|
3650
|
+
"Četvrtak",
|
|
3651
|
+
"Petak",
|
|
3652
|
+
"Subota",
|
|
3653
|
+
];
|
|
3654
|
+
};
|
|
3655
|
+
hr.prototype.monthsOfTheYear = function () {
|
|
3656
|
+
return [
|
|
3657
|
+
"siječanj",
|
|
3658
|
+
"veljača",
|
|
3659
|
+
"ožujak",
|
|
3660
|
+
"travanj",
|
|
3661
|
+
"svibanj",
|
|
3662
|
+
"lipanj",
|
|
3663
|
+
"srpanj",
|
|
3664
|
+
"kolovoz",
|
|
3665
|
+
"rujan",
|
|
3666
|
+
"listopad",
|
|
3667
|
+
"studeni",
|
|
3668
|
+
"prosinac",
|
|
3669
|
+
];
|
|
3670
|
+
};
|
|
3671
|
+
return hr;
|
|
3672
|
+
}());
|
|
3673
|
+
exports.hr = hr;
|
|
3674
|
+
|
|
3675
|
+
|
|
3481
3676
|
/***/ }),
|
|
3482
3677
|
|
|
3483
3678
|
/***/ 194:
|
|
@@ -5804,7 +5999,7 @@ var ru = (function () {
|
|
|
5804
5999
|
return ", каждый день";
|
|
5805
6000
|
};
|
|
5806
6001
|
ru.prototype.commaEveryX0DaysOfTheWeek = function (s) {
|
|
5807
|
-
return getPhraseByNumber(s, ["", ", каждые %s дня недели", ", каждые %s дней недели"]);
|
|
6002
|
+
return getPhraseByNumber(s, [", каждый %s день недели", ", каждые %s дня недели", ", каждые %s дней недели"]);
|
|
5808
6003
|
};
|
|
5809
6004
|
ru.prototype.commaX0ThroughX1 = function (s) {
|
|
5810
6005
|
return s && (s[0] == "2" || s[0] == "3") ? ", со %s по %s" : ", с %s по %s";
|