cronstrue 3.35.0 → 3.37.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.
@@ -127,7 +127,7 @@ var CronParser = (function () {
127
127
  if (expressionParts[6].indexOf("1/") == 0) {
128
128
  expressionParts[6] = expressionParts[6].replace("1/", "*/");
129
129
  }
130
- expressionParts[5] = expressionParts[5].replace(/(^\d)|([^#/\s]\d)/g, function (t) {
130
+ expressionParts[5] = expressionParts[5].replace(/(^\d)|([^#/\s\d]\d)/g, function (t) {
131
131
  var dowDigits = t.replace(/\D/, "");
132
132
  var dowDigitsAdjusted = dowDigits;
133
133
  if (_this.dayOfWeekStartIndexZero) {
@@ -684,6 +684,9 @@ var ExpressionDescriptor = (function () {
684
684
  if (isSegmentRangeWithoutIncrement) {
685
685
  currentDescriptionContent = currentDescriptionContent.replace(", ", "");
686
686
  }
687
+ else if (i > 0 && currentDescriptionContent.startsWith(", ")) {
688
+ currentDescriptionContent = currentDescriptionContent.substring(2);
689
+ }
687
690
  descriptionContent += currentDescriptionContent;
688
691
  }
689
692
  else if (!doesExpressionContainIncrement) {
@@ -691,7 +694,7 @@ var ExpressionDescriptor = (function () {
691
694
  }
692
695
  else {
693
696
  var segmentDescription = this.getSegmentDescription(segments[i], allDescription, getSingleItemDescription, getIncrementDescriptionFormat, getRangeDescriptionFormat, getDescriptionFormat);
694
- if (segmentDescription && segmentDescription.startsWith(", ")) {
697
+ if (i > 0 && segmentDescription && segmentDescription.startsWith(", ")) {
695
698
  segmentDescription = segmentDescription.substring(2);
696
699
  }
697
700
  descriptionContent += segmentDescription;
@@ -8739,7 +8742,7 @@ var vi = (function () {
8739
8742
  return ", và hơn %s";
8740
8743
  };
8741
8744
  vi.prototype.commaEveryX0Months = function () {
8742
- return ", mỗi ngày %s tháng";
8745
+ return ", mỗi %s tháng";
8743
8746
  };
8744
8747
  vi.prototype.commaOnlyInX0 = function () {
8745
8748
  return ", chỉ trong %s";
@@ -9263,6 +9266,10 @@ var RangeValidator = (function () {
9263
9266
  RangeValidator.dayOfWeekRange = function (parse, dayOfWeekStartIndexZero) {
9264
9267
  var parsed = parse.split(',');
9265
9268
  for (var i = 0; i < parsed.length; i++) {
9269
+ if (parsed[i].indexOf('#') > -1) {
9270
+ var nthString = parsed[i].substring(parsed[i].indexOf('#') + 1);
9271
+ assert(/^[1-5]$/.test(nthString), 'DOW nth weekday must be >= 1 and <= 5');
9272
+ }
9266
9273
  if (!isNaN(parseInt(parsed[i], 10))) {
9267
9274
  var dayOfWeek = parseInt(parsed[i], 10);
9268
9275
  assert(dayOfWeek >= 0 && dayOfWeek <= 6, dayOfWeekStartIndexZero ? 'DOW part must be >= 0 and <= 6' : 'DOW part must be >= 1 and <= 7');