cronstrue 3.39.0 → 3.40.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
|
@@ -489,7 +489,7 @@ var ExpressionDescriptor = (function () {
|
|
|
489
489
|
var lastDescription = (_a = this.getDayOfWeekDescription(lastItems.join(","))) !== null && _a !== void 0 ? _a : "";
|
|
490
490
|
return (((_b = this.getDayOfWeekDescription(otherItems.join(","))) !== null && _b !== void 0 ? _b : "") +
|
|
491
491
|
"".concat(this.i18n.spaceAnd(), " ") +
|
|
492
|
-
|
|
492
|
+
ExpressionDescriptor.removeLeadingComma(lastDescription));
|
|
493
493
|
}
|
|
494
494
|
description = this.getSegmentDescription(dayOfWeekExpression, this.i18n.commaEveryDay(), function (s, form) {
|
|
495
495
|
var exp = s;
|
|
@@ -586,11 +586,37 @@ var ExpressionDescriptor = (function () {
|
|
|
586
586
|
});
|
|
587
587
|
return description;
|
|
588
588
|
};
|
|
589
|
-
ExpressionDescriptor.
|
|
589
|
+
ExpressionDescriptor.removeLeadingComma = function (description) {
|
|
590
|
+
return description.replace(/^[,،,、]\s*/, "");
|
|
591
|
+
};
|
|
592
|
+
ExpressionDescriptor.prototype.getDayOfMonthDescription = function (dayOfMonthExpression) {
|
|
590
593
|
var _this = this;
|
|
591
594
|
var _a, _b, _c, _d;
|
|
595
|
+
if (dayOfMonthExpression === void 0) { dayOfMonthExpression = this.expressionParts[3]; }
|
|
592
596
|
var description = null;
|
|
593
|
-
var expression =
|
|
597
|
+
var expression = dayOfMonthExpression;
|
|
598
|
+
var dayOfMonthItems = expression.split(",");
|
|
599
|
+
if (dayOfMonthItems.length > 1) {
|
|
600
|
+
var isLastDayOffset_1 = function (s) { return /^L-\d{1,2}$/.test(s); };
|
|
601
|
+
var lastDayOffsetItems = dayOfMonthItems.filter(function (s) { return isLastDayOffset_1(s); });
|
|
602
|
+
var otherItems = dayOfMonthItems
|
|
603
|
+
.filter(function (s) { return !isLastDayOffset_1(s); })
|
|
604
|
+
.sort(function (a, b) { return Number(a.indexOf("L") > -1) - Number(b.indexOf("L") > -1); });
|
|
605
|
+
if (lastDayOffsetItems.length > 0) {
|
|
606
|
+
var parts = (otherItems.length > 0 ? [otherItems.join(",")] : []).concat(lastDayOffsetItems);
|
|
607
|
+
return (parts
|
|
608
|
+
.map(function (part) { var _a; return (_a = _this.getDayOfMonthDescription(part)) !== null && _a !== void 0 ? _a : ""; })
|
|
609
|
+
.filter(function (partDescription) { return partDescription !== ""; })
|
|
610
|
+
.map(function (partDescription, i) {
|
|
611
|
+
if (i === 0) {
|
|
612
|
+
return partDescription;
|
|
613
|
+
}
|
|
614
|
+
return "".concat(_this.i18n.spaceAnd(), " ") + ExpressionDescriptor.removeLeadingComma(partDescription);
|
|
615
|
+
})
|
|
616
|
+
.join(""));
|
|
617
|
+
}
|
|
618
|
+
expression = otherItems.join(",");
|
|
619
|
+
}
|
|
594
620
|
switch (expression) {
|
|
595
621
|
case "L":
|
|
596
622
|
description = this.i18n.commaOnTheLastDayOfTheMonth();
|
|
@@ -640,7 +666,7 @@ var ExpressionDescriptor = (function () {
|
|
|
640
666
|
}, function (s) {
|
|
641
667
|
return _this.i18n.commaBetweenDayX0AndX1OfTheMonth(s);
|
|
642
668
|
}, function (s) {
|
|
643
|
-
return _this.i18n.commaOnDayX0OfTheMonth(s);
|
|
669
|
+
return s == "L" ? _this.i18n.commaOnTheLastDayOfTheMonth() : _this.i18n.commaOnDayX0OfTheMonth(s);
|
|
644
670
|
});
|
|
645
671
|
}
|
|
646
672
|
break;
|