cronstrue 2.31.0 → 2.33.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 CHANGED
@@ -201,6 +201,7 @@ cronstrue.toString("*/5 * * * *", { locale: "es" }); // => Cada 5 minutos
201
201
  - af - Afrikaans (Michael van Niekerk(https://github.com/mvniekerk))
202
202
  - ar - Arabic ([Mohamed Nehad Shalabi](https://github.com/mohamednehad450))
203
203
  - be - Belarusian ([Kirill Mikulich](https://github.com/KirillMikulich))
204
+ - bg - Bulgarian ([kamenf](https://github.com/kamenf))
204
205
  - ca - Catalan ([Francisco Javier Barrena](https://github.com/fjbarrena))
205
206
  - cs - Czech ([hanbar](https://github.com/hanbar))
206
207
  - es - Spanish ([Ivan Santos](https://github.com/ivansg))
@@ -415,9 +415,26 @@ var ExpressionDescriptor = (function () {
415
415
  else if (s.indexOf("L") > -1) {
416
416
  exp = exp.replace("L", "");
417
417
  }
418
+ var parsedExp = parseInt(exp);
419
+ if (_this.options.tzOffset) {
420
+ var hourExpression = _this.expressionParts[2];
421
+ var hour = parseInt(hourExpression) + (_this.options.tzOffset ? _this.options.tzOffset : 0);
422
+ if (hour >= 24) {
423
+ parsedExp++;
424
+ }
425
+ else if (hour < 0) {
426
+ parsedExp--;
427
+ }
428
+ if (parsedExp > 6) {
429
+ parsedExp = 0;
430
+ }
431
+ else if (parsedExp < 0) {
432
+ parsedExp = 6;
433
+ }
434
+ }
418
435
  var description = _this.i18n.daysOfTheWeekInCase
419
- ? _this.i18n.daysOfTheWeekInCase(form)[parseInt(exp)]
420
- : daysOfWeekNames[parseInt(exp)];
436
+ ? _this.i18n.daysOfTheWeekInCase(form)[parsedExp]
437
+ : daysOfWeekNames[parsedExp];
421
438
  if (s.indexOf("#") > -1) {
422
439
  var dayOfWeekOfMonthDescription = null;
423
440
  var dayOfWeekOfMonthNumber = s.substring(s.indexOf("#") + 1);
@@ -637,7 +654,25 @@ var ExpressionDescriptor = (function () {
637
654
  return description;
638
655
  };
639
656
  ExpressionDescriptor.prototype.formatTime = function (hourExpression, minuteExpression, secondExpression) {
640
- var hour = parseInt(hourExpression) + (this.options.tzOffset ? this.options.tzOffset : 0);
657
+ var hourOffset = 0;
658
+ var minuteOffset = 0;
659
+ if (this.options.tzOffset) {
660
+ hourOffset = this.options.tzOffset > 0 ? Math.floor(this.options.tzOffset) : Math.ceil(this.options.tzOffset);
661
+ minuteOffset = (parseFloat((this.options.tzOffset % 1).toFixed(2)));
662
+ if (minuteOffset != 0) {
663
+ minuteOffset *= 60;
664
+ }
665
+ }
666
+ var hour = parseInt(hourExpression) + (hourOffset);
667
+ var minute = parseInt(minuteExpression) + (minuteOffset);
668
+ if (minute >= 60) {
669
+ minute -= 60;
670
+ hour += 1;
671
+ }
672
+ else if (minute < 0) {
673
+ minute += 60;
674
+ hour -= 1;
675
+ }
641
676
  if (hour >= 24) {
642
677
  hour = hour - 24;
643
678
  }
@@ -656,7 +691,6 @@ var ExpressionDescriptor = (function () {
656
691
  hour = 12;
657
692
  }
658
693
  }
659
- var minute = minuteExpression;
660
694
  var second = "";
661
695
  if (secondExpression) {
662
696
  second = ":".concat(("00" + secondExpression).substring(secondExpression.length));
@@ -688,7 +722,7 @@ exports.ExpressionDescriptor = ExpressionDescriptor;
688
722
 
689
723
 
690
724
  Object.defineProperty(exports, "__esModule", ({ value: true }));
691
- 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;
725
+ 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;
692
726
  var en_1 = __webpack_require__(751);
693
727
  Object.defineProperty(exports, "en", ({ enumerable: true, get: function () { return en_1.en; } }));
694
728
  var da_1 = __webpack_require__(904);
@@ -761,6 +795,8 @@ var vi_1 = __webpack_require__(533);
761
795
  Object.defineProperty(exports, "vi", ({ enumerable: true, get: function () { return vi_1.vi; } }));
762
796
  var my_1 = __webpack_require__(863);
763
797
  Object.defineProperty(exports, "my", ({ enumerable: true, get: function () { return my_1.my; } }));
798
+ var bg_1 = __webpack_require__(431);
799
+ Object.defineProperty(exports, "bg", ({ enumerable: true, get: function () { return bg_1.bg; } }));
764
800
 
765
801
 
766
802
  /***/ }),
@@ -1348,6 +1384,197 @@ var be = (function () {
1348
1384
  exports.be = be;
1349
1385
 
1350
1386
 
1387
+ /***/ }),
1388
+
1389
+ /***/ 431:
1390
+ /***/ ((__unused_webpack_module, exports) => {
1391
+
1392
+
1393
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1394
+ exports.bg = void 0;
1395
+ var getPhraseByPlural = function (str, words) {
1396
+ var strAsNumber = str != null ? Number(str) : 0;
1397
+ return strAsNumber < 2 ? words[0] : words[1];
1398
+ };
1399
+ var getPhraseByDayOfWeek = function (str, words) {
1400
+ var strAsNumber = str != null ? Number(str) : 0;
1401
+ return words[[1, 0, 0, 1, 0, 0, 1][strAsNumber]];
1402
+ };
1403
+ var getNumberEnding = function (str, gender) {
1404
+ var strAsNumber = str != null ? Number(str) : 1;
1405
+ strAsNumber = Math.max(Math.min(strAsNumber < 10 || (strAsNumber > 20 && strAsNumber % 10 !== 0) ? strAsNumber % 10 : 3, 3), 1) - 1;
1406
+ var genderIndex = ['м', 'ж', 'ср'].indexOf(gender);
1407
+ return ['в', 'р', 'т'][strAsNumber] + ['и', 'а', 'о'][genderIndex];
1408
+ };
1409
+ var bg = (function () {
1410
+ function bg() {
1411
+ }
1412
+ bg.prototype.atX0SecondsPastTheMinuteGt20 = function () {
1413
+ return null;
1414
+ };
1415
+ bg.prototype.atX0MinutesPastTheHourGt20 = function () {
1416
+ return null;
1417
+ };
1418
+ bg.prototype.commaMonthX0ThroughMonthX1 = function () {
1419
+ return null;
1420
+ };
1421
+ bg.prototype.commaYearX0ThroughYearX1 = function () {
1422
+ return null;
1423
+ };
1424
+ bg.prototype.use24HourTimeFormatByDefault = function () {
1425
+ return true;
1426
+ };
1427
+ bg.prototype.everyMinute = function () {
1428
+ return 'всяка минута';
1429
+ };
1430
+ bg.prototype.everyHour = function () {
1431
+ return 'всеки час';
1432
+ };
1433
+ bg.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
1434
+ return 'Възникна грешка при генериране на описанието на израза. Проверете синтаксиса на cron израза.';
1435
+ };
1436
+ bg.prototype.atSpace = function () {
1437
+ return 'В ';
1438
+ };
1439
+ bg.prototype.everyMinuteBetweenX0AndX1 = function () {
1440
+ return 'Всяка минута от %s до %s';
1441
+ };
1442
+ bg.prototype.at = function () {
1443
+ return 'В';
1444
+ };
1445
+ bg.prototype.spaceAnd = function () {
1446
+ return ' и';
1447
+ };
1448
+ bg.prototype.everySecond = function () {
1449
+ return 'всяка секунда';
1450
+ };
1451
+ bg.prototype.everyX0Seconds = function (s) {
1452
+ return 'всеки %s секунди';
1453
+ };
1454
+ bg.prototype.secondsX0ThroughX1PastTheMinute = function () {
1455
+ return 'секунди от %s до %s';
1456
+ };
1457
+ bg.prototype.atX0SecondsPastTheMinute = function (s) {
1458
+ return "%s-".concat(getNumberEnding(s, 'ж'), " \u0441\u0435\u043A\u0443\u043D\u0434\u0430");
1459
+ };
1460
+ bg.prototype.everyX0Minutes = function (s) {
1461
+ return 'всеки %s минути';
1462
+ };
1463
+ bg.prototype.minutesX0ThroughX1PastTheHour = function () {
1464
+ return 'минути от %s до %s';
1465
+ };
1466
+ bg.prototype.atX0MinutesPastTheHour = function (s) {
1467
+ return "%s-".concat(getNumberEnding(s, 'ж'), " \u043C\u0438\u043D\u0443\u0442a");
1468
+ };
1469
+ bg.prototype.everyX0Hours = function (s) {
1470
+ return 'всеки %s часа';
1471
+ };
1472
+ bg.prototype.betweenX0AndX1 = function () {
1473
+ return 'от %s до %s';
1474
+ };
1475
+ bg.prototype.atX0 = function () {
1476
+ return 'в %s';
1477
+ };
1478
+ bg.prototype.commaEveryDay = function () {
1479
+ return ', всеки ден';
1480
+ };
1481
+ bg.prototype.commaEveryX0DaysOfTheWeek = function (s) {
1482
+ return getPhraseByPlural(s, [', всеки %s ден от седмицата', ', всеки %s дена от седмицата']);
1483
+ };
1484
+ bg.prototype.commaX0ThroughX1 = function (s) {
1485
+ return ', от %s до %s';
1486
+ };
1487
+ bg.prototype.commaAndX0ThroughX1 = function (s) {
1488
+ return ' и от %s до %s';
1489
+ };
1490
+ bg.prototype.first = function (s) {
1491
+ return getPhraseByDayOfWeek(s, ['первият', 'первата']);
1492
+ };
1493
+ bg.prototype.second = function (s) {
1494
+ return getPhraseByDayOfWeek(s, ['вторият', 'втората']);
1495
+ };
1496
+ bg.prototype.third = function (s) {
1497
+ return getPhraseByDayOfWeek(s, ['третият', 'третата']);
1498
+ };
1499
+ bg.prototype.fourth = function (s) {
1500
+ return getPhraseByDayOfWeek(s, ['четвертият', 'четвертата']);
1501
+ };
1502
+ bg.prototype.fifth = function (s) {
1503
+ return getPhraseByDayOfWeek(s, ['петият', 'петата']);
1504
+ };
1505
+ bg.prototype.commaOnThe = function (s) {
1506
+ return ', ';
1507
+ };
1508
+ bg.prototype.spaceX0OfTheMonth = function () {
1509
+ return ' %s на месеца';
1510
+ };
1511
+ bg.prototype.lastDay = function () {
1512
+ return 'последният ден';
1513
+ };
1514
+ bg.prototype.commaOnTheLastX0OfTheMonth = function (s) {
1515
+ return getPhraseByDayOfWeek(s, [', в последният %s от месеца', ', в последната %s отмесеца']);
1516
+ };
1517
+ bg.prototype.commaOnlyOnX0 = function (s) {
1518
+ return ', %s';
1519
+ };
1520
+ bg.prototype.commaAndOnX0 = function () {
1521
+ return ' и %s';
1522
+ };
1523
+ bg.prototype.commaEveryX0Months = function (s) {
1524
+ return ' всеки %s месеца';
1525
+ };
1526
+ bg.prototype.commaOnlyInMonthX0 = function () {
1527
+ return ', %s';
1528
+ };
1529
+ bg.prototype.commaOnlyInX0 = function () {
1530
+ return ', в %s';
1531
+ };
1532
+ bg.prototype.commaOnTheLastDayOfTheMonth = function () {
1533
+ return ', в последният ден на месеца';
1534
+ };
1535
+ bg.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
1536
+ return ', в последния делничен ден от месеца';
1537
+ };
1538
+ bg.prototype.commaDaysBeforeTheLastDayOfTheMonth = function (s) {
1539
+ return getPhraseByPlural(s, [', %s ден преди края на месеца', ', %s дена преди края на месеца']);
1540
+ };
1541
+ bg.prototype.firstWeekday = function () {
1542
+ return 'първият делничен ден';
1543
+ };
1544
+ bg.prototype.weekdayNearestDayX0 = function () {
1545
+ return 'най-близкият делничен ден до %s число';
1546
+ };
1547
+ bg.prototype.commaOnTheX0OfTheMonth = function () {
1548
+ return ', на %s число от месеца';
1549
+ };
1550
+ bg.prototype.commaEveryX0Days = function (s) {
1551
+ return getPhraseByPlural(s, [', всеки %s ден', ', всеки %s дена']);
1552
+ };
1553
+ bg.prototype.commaBetweenDayX0AndX1OfTheMonth = function (s) {
1554
+ var _a;
1555
+ var values = (_a = s === null || s === void 0 ? void 0 : s.split('-')) !== null && _a !== void 0 ? _a : [];
1556
+ return ", \u043E\u0442 %s-".concat(getNumberEnding(values[0], 'ср'), " \u0434\u043E %s-").concat(getNumberEnding(values[1], 'ср'), " \u0447\u0438\u0441\u043B\u043E \u043D\u0430 \u043C\u0435\u0441\u0435\u0446\u0430");
1557
+ };
1558
+ bg.prototype.commaOnDayX0OfTheMonth = function (s) {
1559
+ return ", \u043D\u0430 %s-".concat(getNumberEnding(s, 'ср'), " \u0447\u0438\u0441\u043B\u043E \u043E\u0442 \u043C\u0435\u0441\u0435\u0446\u0430");
1560
+ };
1561
+ bg.prototype.commaEveryX0Years = function (s) {
1562
+ return getPhraseByPlural(s, [', всяка %s година', ', всеки %s години']);
1563
+ };
1564
+ bg.prototype.commaStartingX0 = function () {
1565
+ return ', започвайки %s';
1566
+ };
1567
+ bg.prototype.daysOfTheWeek = function () {
1568
+ return ['неделя', 'понеделник', 'вторник', 'сряда', 'четвъртък', 'петък', 'събота'];
1569
+ };
1570
+ bg.prototype.monthsOfTheYear = function () {
1571
+ return ['януари', 'февруари', 'март', 'април', 'май', 'юни', 'юли', 'август', 'септевмври', 'октомври', 'ноември', 'декември'];
1572
+ };
1573
+ return bg;
1574
+ }());
1575
+ exports.bg = bg;
1576
+
1577
+
1351
1578
  /***/ }),
1352
1579
 
1353
1580
  /***/ 708: