cronstrue 3.51.0 → 3.53.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/dist/cronstrue-i18n.js
CHANGED
|
@@ -473,9 +473,10 @@ var ExpressionDescriptor = (function () {
|
|
|
473
473
|
bounds: { min: 0, max: 23 },
|
|
474
474
|
});
|
|
475
475
|
};
|
|
476
|
-
ExpressionDescriptor.prototype.getDayOfWeekDescription = function (dayOfWeekExpression) {
|
|
476
|
+
ExpressionDescriptor.prototype.getDayOfWeekDescription = function (dayOfWeekExpression, isFirstClause) {
|
|
477
477
|
var _this = this;
|
|
478
478
|
if (dayOfWeekExpression === void 0) { dayOfWeekExpression = this.expressionParts[5]; }
|
|
479
|
+
if (isFirstClause === void 0) { isFirstClause = true; }
|
|
479
480
|
var daysOfWeekNames = this.i18n.daysOfTheWeek();
|
|
480
481
|
var description = null;
|
|
481
482
|
if (dayOfWeekExpression == "*") {
|
|
@@ -487,7 +488,7 @@ var ExpressionDescriptor = (function () {
|
|
|
487
488
|
var _a, _b;
|
|
488
489
|
return ((_a = _this.getDayOfWeekDescription(items.join(","))) !== null && _a !== void 0 ? _a : "") +
|
|
489
490
|
"".concat(_this.i18n.spaceAnd(), " ") +
|
|
490
|
-
ExpressionDescriptor.removeLeadingComma((_b = _this.getDayOfWeekDescription(otherItems.join(","))) !== null && _b !== void 0 ? _b : "");
|
|
491
|
+
ExpressionDescriptor.removeLeadingComma((_b = _this.getDayOfWeekDescription(otherItems.join(","), false)) !== null && _b !== void 0 ? _b : "");
|
|
491
492
|
};
|
|
492
493
|
var nthOrLastItems = dayOfWeekItems.filter(function (s) { return /[#L]/.test(s); });
|
|
493
494
|
var plainItems = dayOfWeekItems.filter(function (s) { return !/[#L]/.test(s); });
|
|
@@ -503,6 +504,18 @@ var ExpressionDescriptor = (function () {
|
|
|
503
504
|
var stepSegments = dayOfWeekExpression.split("/");
|
|
504
505
|
var hasStep_1 = stepSegments.length > 1 && parseInt(stepSegments[1]) != 1;
|
|
505
506
|
var andPrefix_1 = this.getAndPrefix();
|
|
507
|
+
var isListWithStep = dayOfWeekItems.length > 1 && dayOfWeekExpression.indexOf("/") > -1;
|
|
508
|
+
var andWord_1 = andPrefix_1 ? ExpressionDescriptor.removeLeadingComma(andPrefix_1).trim() : "";
|
|
509
|
+
var dayWithAnd_1 = ExpressionDescriptor.removeLeadingComma(this.i18n.commaAndOnX0()).replace(/^\s+/, "");
|
|
510
|
+
var dropsDayAnd_1 = isListWithStep &&
|
|
511
|
+
this.expressionParts[3] != "*" &&
|
|
512
|
+
!this.options.logicalAndDayFields &&
|
|
513
|
+
!!andWord_1 &&
|
|
514
|
+
dayWithAnd_1.indexOf(andWord_1 + " ") == 0;
|
|
515
|
+
var nthOrLastAndPrefix_1 = isFirstClause && this.expressionParts[3] != "*" && !this.options.logicalAndDayFields ? andPrefix_1 : null;
|
|
516
|
+
var withNthOrLastAnd_1 = function (format) {
|
|
517
|
+
return nthOrLastAndPrefix_1 ? nthOrLastAndPrefix_1 + ExpressionDescriptor.removeLeadingComma(format) : format;
|
|
518
|
+
};
|
|
506
519
|
description = this.getSegmentDescription(dayOfWeekExpression, {
|
|
507
520
|
all: this.i18n.commaEveryDay(),
|
|
508
521
|
single: function (s, form) {
|
|
@@ -543,10 +556,10 @@ var ExpressionDescriptor = (function () {
|
|
|
543
556
|
if (s.indexOf("#") > -1) {
|
|
544
557
|
var dayOfWeekOfMonthNumber = s.substring(s.indexOf("#") + 1);
|
|
545
558
|
var dayOfWeek = s.substring(0, s.indexOf("#"));
|
|
546
|
-
format = _this.i18n.commaOnThe(dayOfWeekOfMonthNumber, dayOfWeek).trim() + _this.i18n.spaceX0OfTheMonth();
|
|
559
|
+
format = withNthOrLastAnd_1(_this.i18n.commaOnThe(dayOfWeekOfMonthNumber, dayOfWeek).trim() + _this.i18n.spaceX0OfTheMonth());
|
|
547
560
|
}
|
|
548
561
|
else if (s.indexOf("L") > -1) {
|
|
549
|
-
format = _this.i18n.commaOnTheLastX0OfTheMonth(s.split(",")[0].replace("L", ""));
|
|
562
|
+
format = withNthOrLastAnd_1(_this.i18n.commaOnTheLastX0OfTheMonth(s.split(",")[0].replace("L", "")));
|
|
550
563
|
}
|
|
551
564
|
else {
|
|
552
565
|
var domSpecified = _this.expressionParts[3] != "*";
|
|
@@ -556,6 +569,9 @@ var ExpressionDescriptor = (function () {
|
|
|
556
569
|
else if (_this.options.logicalAndDayFields) {
|
|
557
570
|
format = _this.i18n.commaOnlyOnX0(s);
|
|
558
571
|
}
|
|
572
|
+
else if (dropsDayAnd_1) {
|
|
573
|
+
format = dayWithAnd_1.substring(andWord_1.length).replace(/^\s+/, "");
|
|
574
|
+
}
|
|
559
575
|
else {
|
|
560
576
|
format = _this.i18n.commaAndOnX0();
|
|
561
577
|
}
|
|
@@ -564,14 +580,13 @@ var ExpressionDescriptor = (function () {
|
|
|
564
580
|
},
|
|
565
581
|
});
|
|
566
582
|
var firstItem = dayOfWeekItems[0];
|
|
567
|
-
var isListWithStep = dayOfWeekItems.length > 1 && dayOfWeekExpression.indexOf("/") > -1;
|
|
568
583
|
var firstStep = firstItem.split("/")[1];
|
|
569
584
|
if (isListWithStep &&
|
|
570
585
|
andPrefix_1 &&
|
|
571
586
|
description &&
|
|
572
587
|
this.expressionParts[3] != "*" &&
|
|
573
588
|
!this.options.logicalAndDayFields &&
|
|
574
|
-
(firstStep === undefined ? firstItem.indexOf("-") > -1 : parseInt(firstStep) != 1)) {
|
|
589
|
+
(firstStep === undefined ? firstItem.indexOf("-") > -1 || dropsDayAnd_1 : parseInt(firstStep) != 1)) {
|
|
575
590
|
description = andPrefix_1 + ExpressionDescriptor.removeLeadingComma(description);
|
|
576
591
|
}
|
|
577
592
|
}
|