cronstrue 3.37.0 → 3.39.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]\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) {
@@ -472,15 +472,26 @@ var ExpressionDescriptor = (function () {
472
472
  }, { min: 0, max: 23 });
473
473
  return description;
474
474
  };
475
- ExpressionDescriptor.prototype.getDayOfWeekDescription = function () {
475
+ ExpressionDescriptor.prototype.getDayOfWeekDescription = function (dayOfWeekExpression) {
476
476
  var _this = this;
477
+ var _a, _b;
478
+ if (dayOfWeekExpression === void 0) { dayOfWeekExpression = this.expressionParts[5]; }
477
479
  var daysOfWeekNames = this.i18n.daysOfTheWeek();
478
480
  var description = null;
479
- if (this.expressionParts[5] == "*") {
481
+ if (dayOfWeekExpression == "*") {
480
482
  description = "";
481
483
  }
482
484
  else {
483
- description = this.getSegmentDescription(this.expressionParts[5], this.i18n.commaEveryDay(), function (s, form) {
485
+ var dayOfWeekItems = dayOfWeekExpression.split(",");
486
+ var lastItems = dayOfWeekItems.filter(function (s) { return s.indexOf("L") > -1; });
487
+ var otherItems = dayOfWeekItems.filter(function (s) { return s.indexOf("L") === -1; });
488
+ if (lastItems.length > 0 && otherItems.length > 0) {
489
+ var lastDescription = (_a = this.getDayOfWeekDescription(lastItems.join(","))) !== null && _a !== void 0 ? _a : "";
490
+ return (((_b = this.getDayOfWeekDescription(otherItems.join(","))) !== null && _b !== void 0 ? _b : "") +
491
+ "".concat(this.i18n.spaceAnd(), " ") +
492
+ (lastDescription.startsWith(", ") ? lastDescription.substring(2) : lastDescription));
493
+ }
494
+ description = this.getSegmentDescription(dayOfWeekExpression, this.i18n.commaEveryDay(), function (s, form) {
484
495
  var exp = s;
485
496
  if (s.indexOf("#") > -1) {
486
497
  exp = s.substring(0, s.indexOf("#"));
@@ -805,9 +816,9 @@ var ExpressionDescriptor = (function () {
805
816
  };
806
817
  ExpressionDescriptor.prototype.transformVerbosity = function (description, useVerboseFormat) {
807
818
  if (!useVerboseFormat) {
808
- description = description.replace(new RegExp(", ".concat(this.i18n.everyMinute()), "g"), "");
809
- description = description.replace(new RegExp(", ".concat(this.i18n.everyHour()), "g"), "");
810
- description = description.replace(new RegExp(this.i18n.commaEveryDay(), "g"), "");
819
+ description = description.replace(new RegExp(", ".concat(this.i18n.everyMinute(), "(?!\\s*[\\p{L}\\p{N}])"), "gu"), "");
820
+ description = description.replace(new RegExp(", ".concat(this.i18n.everyHour(), "(?!\\s*[\\p{L}\\p{N}])"), "gu"), "");
821
+ description = description.replace(new RegExp("".concat(this.i18n.commaEveryDay(), "(?!\\s*[\\p{L}\\p{N}])"), "gu"), "");
811
822
  description = description.replace(/\, ?$/, "");
812
823
  if (this.i18n.conciseVerbosityReplacements) {
813
824
  for (var _i = 0, _a = Object.entries(this.i18n.conciseVerbosityReplacements()); _i < _a.length; _i++) {
@@ -3269,7 +3280,7 @@ var fa = (function () {
3269
3280
  return "آخرین روز";
3270
3281
  };
3271
3282
  fa.prototype.commaOnTheLastX0OfTheMonth = function () {
3272
- return ", در %s ماه";
3283
+ return ", در آخرین %s ماه";
3273
3284
  };
3274
3285
  fa.prototype.commaOnlyOnX0 = function () {
3275
3286
  return ", فقط در %s";
@@ -3287,13 +3298,13 @@ var fa = (function () {
3287
3298
  return ", در آخرین روز ماه";
3288
3299
  };
3289
3300
  fa.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
3290
- return ", در آخرین روز ماه";
3301
+ return ", در آخرین روز کاری ماه";
3291
3302
  };
3292
3303
  fa.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
3293
3304
  return ", %s روز قبل از آخرین روز ماه";
3294
3305
  };
3295
3306
  fa.prototype.firstWeekday = function () {
3296
- return "اولین روز";
3307
+ return "اولین روز کاری";
3297
3308
  };
3298
3309
  fa.prototype.weekdayNearestDayX0 = function () {
3299
3310
  return "روز نزدیک به روز %s";
@@ -3855,7 +3866,7 @@ var he = (function () {
3855
3866
  return "היום האחרון";
3856
3867
  };
3857
3868
  he.prototype.commaOnTheLastX0OfTheMonth = function () {
3858
- return ", רק ב %s של החודש";
3869
+ return ", ב%s האחרון של החודש";
3859
3870
  };
3860
3871
  he.prototype.commaOnlyOnX0 = function () {
3861
3872
  return ", רק ב %s";
@@ -4590,7 +4601,7 @@ var it = (function () {
4590
4601
  return ", l'ultimo giorno del mese";
4591
4602
  };
4592
4603
  it.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
4593
- return ", nell'ultima settimana del mese";
4604
+ return ", l'ultimo giorno feriale del mese";
4594
4605
  };
4595
4606
  it.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
4596
4607
  return ", %s giorni prima dell'ultimo giorno del mese";
@@ -5215,7 +5226,7 @@ var my = (function () {
5215
5226
  return ", pada hari terakhir bulan";
5216
5227
  };
5217
5228
  my.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
5218
- return ", pada minggu terakhir bulan";
5229
+ return ", pada hari bekerja terakhir bulan";
5219
5230
  };
5220
5231
  my.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
5221
5232
  return ", %s hari sebelum hari terakhir bulan";
@@ -7741,7 +7752,7 @@ var sw = (function () {
7741
7752
  return "siku ya mwisho";
7742
7753
  };
7743
7754
  sw.prototype.commaOnTheLastX0OfTheMonth = function () {
7744
- return ", siku ya %s ya mwezi";
7755
+ return ", %s ya mwisho ya mwezi";
7745
7756
  };
7746
7757
  sw.prototype.commaOnlyOnX0 = function () {
7747
7758
  return ", kwa %s tu";
@@ -7759,7 +7770,7 @@ var sw = (function () {
7759
7770
  return ", siku ya mwisho wa mwezi";
7760
7771
  };
7761
7772
  sw.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
7762
- return ", wikendi ya mwisho wa mwezi";
7773
+ return ", siku ya kazi ya mwisho wa mwezi";
7763
7774
  };
7764
7775
  sw.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
7765
7776
  return ", siku ya %s kabla ya siku ya mwisho wa mwezi";
@@ -8378,7 +8389,7 @@ var tr = (function () {
8378
8389
  return "ilk iş günü";
8379
8390
  };
8380
8391
  tr.prototype.weekdayNearestDayX0 = function () {
8381
- return "%s. günü sonrasındaki ilk iş günü";
8392
+ return "%s. gününe en yakın iş günü";
8382
8393
  };
8383
8394
  tr.prototype.commaOnTheX0OfTheMonth = function () {
8384
8395
  return ", ayın %s";
@@ -8751,19 +8762,19 @@ var vi = (function () {
8751
8762
  return ", vào ngày cuối cùng của tháng";
8752
8763
  };
8753
8764
  vi.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
8754
- return ", vào ngày cuối tuần của tháng";
8765
+ return ", vào ngày làm việc cuối cùng của tháng";
8755
8766
  };
8756
8767
  vi.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
8757
8768
  return ", %s ngày trước ngày cuối cùng của tháng";
8758
8769
  };
8759
8770
  vi.prototype.firstWeekday = function () {
8760
- return "ngày đầu tuần";
8771
+ return "ngày làm việc đầu tiên";
8761
8772
  };
8762
8773
  vi.prototype.weekdayNearestDayX0 = function () {
8763
- return "ngày trong tuần ngày gần nhất %s";
8774
+ return "ngày làm việc gần ngày %s nhất";
8764
8775
  };
8765
8776
  vi.prototype.commaOnTheX0OfTheMonth = function () {
8766
- return ", vào ngày %s của tháng";
8777
+ return ", vào %s của tháng";
8767
8778
  };
8768
8779
  vi.prototype.commaEveryX0Days = function () {
8769
8780
  return ", mỗi %s ngày";
@@ -8963,7 +8974,7 @@ var zh_CN = (function () {
8963
8974
  return ", 限每月的最后一个工作日";
8964
8975
  };
8965
8976
  zh_CN.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
8966
- return ", 限每月最后%s天";
8977
+ return ", 限每月最后一天之前的第%s天";
8967
8978
  };
8968
8979
  zh_CN.prototype.firstWeekday = function () {
8969
8980
  return "第一个工作日";
@@ -9150,7 +9161,7 @@ var zh_TW = (function () {
9150
9161
  return ", 每月的最後一個工作日";
9151
9162
  };
9152
9163
  zh_TW.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
9153
- return ", %s 這個月的最後一天的前幾天";
9164
+ return ", 每月最後一天之前的第 %s 天";
9154
9165
  };
9155
9166
  zh_TW.prototype.firstWeekday = function () {
9156
9167
  return "第一個工作日";
@@ -9208,6 +9219,17 @@ function assert(value, message) {
9208
9219
  throw new Error(message);
9209
9220
  }
9210
9221
  }
9222
+ function rangeValues(part) {
9223
+ var values = [];
9224
+ if (!isNaN(parseInt(part, 10))) {
9225
+ values.push(parseInt(part, 10));
9226
+ var range = part.match(/^\d+-(-?\d+)/);
9227
+ if (range) {
9228
+ values.push(parseInt(range[1], 10));
9229
+ }
9230
+ }
9231
+ return values;
9232
+ }
9211
9233
  var RangeValidator = (function () {
9212
9234
  function RangeValidator() {
9213
9235
  }
@@ -9221,8 +9243,8 @@ var RangeValidator = (function () {
9221
9243
  RangeValidator.secondRange = function (parse) {
9222
9244
  var parsed = parse.split(',');
9223
9245
  for (var i = 0; i < parsed.length; i++) {
9224
- if (!isNaN(parseInt(parsed[i], 10))) {
9225
- var second = parseInt(parsed[i], 10);
9246
+ for (var _i = 0, _a = rangeValues(parsed[i]); _i < _a.length; _i++) {
9247
+ var second = _a[_i];
9226
9248
  assert(second >= 0 && second <= 59, 'seconds part must be >= 0 and <= 59');
9227
9249
  }
9228
9250
  }
@@ -9230,8 +9252,8 @@ var RangeValidator = (function () {
9230
9252
  RangeValidator.minuteRange = function (parse) {
9231
9253
  var parsed = parse.split(',');
9232
9254
  for (var i = 0; i < parsed.length; i++) {
9233
- if (!isNaN(parseInt(parsed[i], 10))) {
9234
- var minute = parseInt(parsed[i], 10);
9255
+ for (var _i = 0, _a = rangeValues(parsed[i]); _i < _a.length; _i++) {
9256
+ var minute = _a[_i];
9235
9257
  assert(minute >= 0 && minute <= 59, 'minutes part must be >= 0 and <= 59');
9236
9258
  }
9237
9259
  }
@@ -9239,8 +9261,8 @@ var RangeValidator = (function () {
9239
9261
  RangeValidator.hourRange = function (parse) {
9240
9262
  var parsed = parse.split(',');
9241
9263
  for (var i = 0; i < parsed.length; i++) {
9242
- if (!isNaN(parseInt(parsed[i], 10))) {
9243
- var hour = parseInt(parsed[i], 10);
9264
+ for (var _i = 0, _a = rangeValues(parsed[i]); _i < _a.length; _i++) {
9265
+ var hour = _a[_i];
9244
9266
  assert(hour >= 0 && hour <= 23, 'hours part must be >= 0 and <= 23');
9245
9267
  }
9246
9268
  }
@@ -9248,8 +9270,8 @@ var RangeValidator = (function () {
9248
9270
  RangeValidator.dayOfMonthRange = function (parse) {
9249
9271
  var parsed = parse.split(',');
9250
9272
  for (var i = 0; i < parsed.length; i++) {
9251
- if (!isNaN(parseInt(parsed[i], 10))) {
9252
- var dayOfMonth = parseInt(parsed[i], 10);
9273
+ for (var _i = 0, _a = rangeValues(parsed[i]); _i < _a.length; _i++) {
9274
+ var dayOfMonth = _a[_i];
9253
9275
  assert(dayOfMonth >= 1 && dayOfMonth <= 31, 'DOM part must be >= 1 and <= 31');
9254
9276
  }
9255
9277
  }
@@ -9257,8 +9279,8 @@ var RangeValidator = (function () {
9257
9279
  RangeValidator.monthRange = function (parse, monthStartIndexZero) {
9258
9280
  var parsed = parse.split(',');
9259
9281
  for (var i = 0; i < parsed.length; i++) {
9260
- if (!isNaN(parseInt(parsed[i], 10))) {
9261
- var month = parseInt(parsed[i], 10);
9282
+ for (var _i = 0, _a = rangeValues(parsed[i]); _i < _a.length; _i++) {
9283
+ var month = _a[_i];
9262
9284
  assert(month >= 1 && month <= 12, monthStartIndexZero ? 'month part must be >= 0 and <= 11' : 'month part must be >= 1 and <= 12');
9263
9285
  }
9264
9286
  }
@@ -9270,8 +9292,8 @@ var RangeValidator = (function () {
9270
9292
  var nthString = parsed[i].substring(parsed[i].indexOf('#') + 1);
9271
9293
  assert(/^[1-5]$/.test(nthString), 'DOW nth weekday must be >= 1 and <= 5');
9272
9294
  }
9273
- if (!isNaN(parseInt(parsed[i], 10))) {
9274
- var dayOfWeek = parseInt(parsed[i], 10);
9295
+ for (var _i = 0, _a = rangeValues(parsed[i]); _i < _a.length; _i++) {
9296
+ var dayOfWeek = _a[_i];
9275
9297
  assert(dayOfWeek >= 0 && dayOfWeek <= 6, dayOfWeekStartIndexZero ? 'DOW part must be >= 0 and <= 6' : 'DOW part must be >= 1 and <= 7');
9276
9298
  }
9277
9299
  }