cronstrue 3.50.0 → 3.52.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.
@@ -503,6 +503,14 @@ var ExpressionDescriptor = (function () {
503
503
  var stepSegments = dayOfWeekExpression.split("/");
504
504
  var hasStep_1 = stepSegments.length > 1 && parseInt(stepSegments[1]) != 1;
505
505
  var andPrefix_1 = this.getAndPrefix();
506
+ var isListWithStep = dayOfWeekItems.length > 1 && dayOfWeekExpression.indexOf("/") > -1;
507
+ var andWord_1 = andPrefix_1 ? ExpressionDescriptor.removeLeadingComma(andPrefix_1).trim() : "";
508
+ var dayWithAnd_1 = ExpressionDescriptor.removeLeadingComma(this.i18n.commaAndOnX0()).replace(/^\s+/, "");
509
+ var dropsDayAnd_1 = isListWithStep &&
510
+ this.expressionParts[3] != "*" &&
511
+ !this.options.logicalAndDayFields &&
512
+ !!andWord_1 &&
513
+ dayWithAnd_1.indexOf(andWord_1 + " ") == 0;
506
514
  description = this.getSegmentDescription(dayOfWeekExpression, {
507
515
  all: this.i18n.commaEveryDay(),
508
516
  single: function (s, form) {
@@ -556,6 +564,9 @@ var ExpressionDescriptor = (function () {
556
564
  else if (_this.options.logicalAndDayFields) {
557
565
  format = _this.i18n.commaOnlyOnX0(s);
558
566
  }
567
+ else if (dropsDayAnd_1) {
568
+ format = dayWithAnd_1.substring(andWord_1.length).replace(/^\s+/, "");
569
+ }
559
570
  else {
560
571
  format = _this.i18n.commaAndOnX0();
561
572
  }
@@ -563,6 +574,16 @@ var ExpressionDescriptor = (function () {
563
574
  return format;
564
575
  },
565
576
  });
577
+ var firstItem = dayOfWeekItems[0];
578
+ var firstStep = firstItem.split("/")[1];
579
+ if (isListWithStep &&
580
+ andPrefix_1 &&
581
+ description &&
582
+ this.expressionParts[3] != "*" &&
583
+ !this.options.logicalAndDayFields &&
584
+ (firstStep === undefined ? firstItem.indexOf("-") > -1 || dropsDayAnd_1 : parseInt(firstStep) != 1)) {
585
+ description = andPrefix_1 + ExpressionDescriptor.removeLeadingComma(description);
586
+ }
566
587
  }
567
588
  return description;
568
589
  };
@@ -721,9 +742,9 @@ var ExpressionDescriptor = (function () {
721
742
  descriptionContent += conjunction == "," && segments.length > 2 ? " " : "".concat(conjunction, " ");
722
743
  }
723
744
  if (segments[i].indexOf("/") > -1 || segments[i].indexOf("-") > -1) {
724
- var isSegmentRangeWithoutIncrement = segments[i].indexOf("-") > -1 && segments[i].indexOf("/") == -1;
725
- var currentDescriptionContent = this.getSegmentDescription(segments[i], isSegmentRangeWithoutIncrement ? __assign(__assign({}, itemDescribers), { range: this.i18n.commaX0ThroughX1 }) : itemDescribers);
726
- if (isSegmentRangeWithoutIncrement || i > 0) {
745
+ var isBareRange = !doesExpressionContainIncrement && segments[i].indexOf("-") > -1 && segments[i].indexOf("/") == -1;
746
+ var currentDescriptionContent = this.getSegmentDescription(segments[i], isBareRange ? __assign(__assign({}, itemDescribers), { range: this.i18n.commaX0ThroughX1 }) : itemDescribers);
747
+ if (isBareRange || i > 0) {
727
748
  currentDescriptionContent = ExpressionDescriptor.removeLeadingComma(currentDescriptionContent);
728
749
  }
729
750
  descriptionContent += currentDescriptionContent;