cronstrue 2.57.0 → 2.59.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.
@@ -427,8 +427,24 @@ var ExpressionDescriptor = (function () {
427
427
  ExpressionDescriptor.prototype.getHoursDescription = function () {
428
428
  var _this = this;
429
429
  var expression = this.expressionParts[2];
430
+ var hourIndex = 0;
431
+ var rangeEndValues = [];
432
+ expression
433
+ .split("/")[0]
434
+ .split(",")
435
+ .forEach(function (range) {
436
+ var rangeParts = range.split("-");
437
+ if (rangeParts.length === 2) {
438
+ rangeEndValues.push({ value: rangeParts[1], index: hourIndex + 1 });
439
+ }
440
+ hourIndex += rangeParts.length;
441
+ });
442
+ var evaluationIndex = 0;
430
443
  var description = this.getSegmentDescription(expression, this.i18n.everyHour(), function (s) {
431
- return _this.formatTime(s, "0", "");
444
+ var match = rangeEndValues.find(function (r) { return r.value === s && r.index === evaluationIndex; });
445
+ var isRangeEndWithNonZeroMinute = match && _this.expressionParts[1] !== "0";
446
+ evaluationIndex++;
447
+ return isRangeEndWithNonZeroMinute ? _this.formatTime(s, "59", "") : _this.formatTime(s, "0", "");
432
448
  }, function (s) {
433
449
  return stringUtilities_1.StringUtilities.format(_this.i18n.everyX0Hours(s), s);
434
450
  }, function (s) {
@@ -436,16 +452,6 @@ var ExpressionDescriptor = (function () {
436
452
  }, function (s) {
437
453
  return _this.i18n.atX0();
438
454
  });
439
- if (description && expression.includes("-") && this.expressionParts[1] != "0") {
440
- var atTheHourMatches = Array.from(description.matchAll(/:00/g));
441
- if (atTheHourMatches.length > 1) {
442
- var lastAtTheHourMatchIndex = atTheHourMatches[atTheHourMatches.length - 1].index;
443
- description =
444
- description.substring(0, lastAtTheHourMatchIndex) +
445
- ":59" +
446
- description.substring(lastAtTheHourMatchIndex + 3);
447
- }
448
- }
449
455
  return description;
450
456
  };
451
457
  ExpressionDescriptor.prototype.getDayOfWeekDescription = function () {
@@ -2060,8 +2066,8 @@ var da = (function () {
2060
2066
  da.prototype.commaOnlyInX0 = function () {
2061
2067
  return ", kun i %s";
2062
2068
  };
2063
- da.prototype.commaOnlyOnX0 = function () {
2064
- return ", på %se";
2069
+ da.prototype.commaOnlyOnX0 = function (s) {
2070
+ return ", på enhver %s";
2065
2071
  };
2066
2072
  da.prototype.commaAndOnX0 = function () {
2067
2073
  return ", og på %s";