cronstrue 3.46.0 → 3.47.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.
@@ -482,6 +482,10 @@ var ExpressionDescriptor = (function () {
482
482
  if (lastItems.length > 0 && otherItems.length > 0) {
483
483
  return describeSeparately(otherItems, lastItems);
484
484
  }
485
+ var startsWithAnd_1 = this.expressionParts[3] != "*" && !this.options.logicalAndDayFields && dayOfWeekExpression.indexOf(",") == -1;
486
+ var stepSegments = dayOfWeekExpression.split("/");
487
+ var hasStep_1 = stepSegments.length > 1 && parseInt(stepSegments[1]) != 1;
488
+ var andPrefix_1 = this.getAndPrefix();
485
489
  description = this.getSegmentDescription(dayOfWeekExpression, {
486
490
  all: this.i18n.commaEveryDay(),
487
491
  single: function (s, form) {
@@ -505,12 +509,17 @@ var ExpressionDescriptor = (function () {
505
509
  return description;
506
510
  },
507
511
  increment: function (s) {
508
- return parseInt(s) == 1 ? "" : stringUtilities_1.StringUtilities.format(_this.i18n.commaEveryX0DaysOfTheWeek(s), s);
512
+ if (parseInt(s) == 1) {
513
+ return "";
514
+ }
515
+ var format = _this.i18n.commaEveryX0DaysOfTheWeek(s);
516
+ return stringUtilities_1.StringUtilities.format(startsWithAnd_1 && andPrefix_1 ? andPrefix_1 + ExpressionDescriptor.removeLeadingComma(format) : format, s);
509
517
  },
510
518
  range: function (s) {
511
519
  var beginFrom = s.substring(0, s.indexOf("-"));
512
- var domSpecified = _this.expressionParts[3] != "*";
513
- return domSpecified ? _this.i18n.commaAndX0ThroughX1(beginFrom) : _this.i18n.commaX0ThroughX1(beginFrom);
520
+ return startsWithAnd_1 && (!hasStep_1 || !andPrefix_1)
521
+ ? _this.i18n.commaAndX0ThroughX1(beginFrom)
522
+ : _this.i18n.commaX0ThroughX1(beginFrom);
514
523
  },
515
524
  format: function (s) {
516
525
  var format = null;
@@ -557,6 +566,15 @@ var ExpressionDescriptor = (function () {
557
566
  format: function () { return (_this.i18n.commaOnlyInMonthX0 ? _this.i18n.commaOnlyInMonthX0() : _this.i18n.commaOnlyInX0()); },
558
567
  });
559
568
  };
569
+ ExpressionDescriptor.prototype.getAndPrefix = function () {
570
+ var plain = this.i18n.commaX0ThroughX1();
571
+ var withAnd = this.i18n.commaAndX0ThroughX1();
572
+ var body = ExpressionDescriptor.removeLeadingComma(plain);
573
+ if (withAnd == plain || withAnd.length <= body.length || withAnd.slice(-body.length) != body) {
574
+ return null;
575
+ }
576
+ return withAnd.slice(0, -body.length);
577
+ };
560
578
  ExpressionDescriptor.removeLeadingComma = function (description) {
561
579
  return description.replace(/^[,،,、] ?/, "");
562
580
  };
@@ -2742,7 +2760,7 @@ var en = (function () {
2742
2760
  return ", %s through %s";
2743
2761
  };
2744
2762
  en.prototype.commaAndX0ThroughX1 = function () {
2745
- return ", %s through %s";
2763
+ return ", and %s through %s";
2746
2764
  };
2747
2765
  en.prototype.first = function () {
2748
2766
  return "first";