cronstrue 3.38.0 → 3.40.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.
@@ -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
+ ExpressionDescriptor.removeLeadingComma(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("#"));
@@ -575,11 +586,37 @@ var ExpressionDescriptor = (function () {
575
586
  });
576
587
  return description;
577
588
  };
578
- ExpressionDescriptor.prototype.getDayOfMonthDescription = function () {
589
+ ExpressionDescriptor.removeLeadingComma = function (description) {
590
+ return description.replace(/^[,،,、]\s*/, "");
591
+ };
592
+ ExpressionDescriptor.prototype.getDayOfMonthDescription = function (dayOfMonthExpression) {
579
593
  var _this = this;
580
594
  var _a, _b, _c, _d;
595
+ if (dayOfMonthExpression === void 0) { dayOfMonthExpression = this.expressionParts[3]; }
581
596
  var description = null;
582
- var expression = this.expressionParts[3];
597
+ var expression = dayOfMonthExpression;
598
+ var dayOfMonthItems = expression.split(",");
599
+ if (dayOfMonthItems.length > 1) {
600
+ var isLastDayOffset_1 = function (s) { return /^L-\d{1,2}$/.test(s); };
601
+ var lastDayOffsetItems = dayOfMonthItems.filter(function (s) { return isLastDayOffset_1(s); });
602
+ var otherItems = dayOfMonthItems
603
+ .filter(function (s) { return !isLastDayOffset_1(s); })
604
+ .sort(function (a, b) { return Number(a.indexOf("L") > -1) - Number(b.indexOf("L") > -1); });
605
+ if (lastDayOffsetItems.length > 0) {
606
+ var parts = (otherItems.length > 0 ? [otherItems.join(",")] : []).concat(lastDayOffsetItems);
607
+ return (parts
608
+ .map(function (part) { var _a; return (_a = _this.getDayOfMonthDescription(part)) !== null && _a !== void 0 ? _a : ""; })
609
+ .filter(function (partDescription) { return partDescription !== ""; })
610
+ .map(function (partDescription, i) {
611
+ if (i === 0) {
612
+ return partDescription;
613
+ }
614
+ return "".concat(_this.i18n.spaceAnd(), " ") + ExpressionDescriptor.removeLeadingComma(partDescription);
615
+ })
616
+ .join(""));
617
+ }
618
+ expression = otherItems.join(",");
619
+ }
583
620
  switch (expression) {
584
621
  case "L":
585
622
  description = this.i18n.commaOnTheLastDayOfTheMonth();
@@ -629,7 +666,7 @@ var ExpressionDescriptor = (function () {
629
666
  }, function (s) {
630
667
  return _this.i18n.commaBetweenDayX0AndX1OfTheMonth(s);
631
668
  }, function (s) {
632
- return _this.i18n.commaOnDayX0OfTheMonth(s);
669
+ return s == "L" ? _this.i18n.commaOnTheLastDayOfTheMonth() : _this.i18n.commaOnDayX0OfTheMonth(s);
633
670
  });
634
671
  }
635
672
  break;
@@ -805,9 +842,9 @@ var ExpressionDescriptor = (function () {
805
842
  };
806
843
  ExpressionDescriptor.prototype.transformVerbosity = function (description, useVerboseFormat) {
807
844
  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"), "");
845
+ description = description.replace(new RegExp(", ".concat(this.i18n.everyMinute(), "(?!\\s*[\\p{L}\\p{N}])"), "gu"), "");
846
+ description = description.replace(new RegExp(", ".concat(this.i18n.everyHour(), "(?!\\s*[\\p{L}\\p{N}])"), "gu"), "");
847
+ description = description.replace(new RegExp("".concat(this.i18n.commaEveryDay(), "(?!\\s*[\\p{L}\\p{N}])"), "gu"), "");
811
848
  description = description.replace(/\, ?$/, "");
812
849
  if (this.i18n.conciseVerbosityReplacements) {
813
850
  for (var _i = 0, _a = Object.entries(this.i18n.conciseVerbosityReplacements()); _i < _a.length; _i++) {
@@ -3269,7 +3306,7 @@ var fa = (function () {
3269
3306
  return "آخرین روز";
3270
3307
  };
3271
3308
  fa.prototype.commaOnTheLastX0OfTheMonth = function () {
3272
- return ", در %s ماه";
3309
+ return ", در آخرین %s ماه";
3273
3310
  };
3274
3311
  fa.prototype.commaOnlyOnX0 = function () {
3275
3312
  return ", فقط در %s";
@@ -3287,13 +3324,13 @@ var fa = (function () {
3287
3324
  return ", در آخرین روز ماه";
3288
3325
  };
3289
3326
  fa.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
3290
- return ", در آخرین روز ماه";
3327
+ return ", در آخرین روز کاری ماه";
3291
3328
  };
3292
3329
  fa.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
3293
3330
  return ", %s روز قبل از آخرین روز ماه";
3294
3331
  };
3295
3332
  fa.prototype.firstWeekday = function () {
3296
- return "اولین روز";
3333
+ return "اولین روز کاری";
3297
3334
  };
3298
3335
  fa.prototype.weekdayNearestDayX0 = function () {
3299
3336
  return "روز نزدیک به روز %s";
@@ -3855,7 +3892,7 @@ var he = (function () {
3855
3892
  return "היום האחרון";
3856
3893
  };
3857
3894
  he.prototype.commaOnTheLastX0OfTheMonth = function () {
3858
- return ", רק ב %s של החודש";
3895
+ return ", ב%s האחרון של החודש";
3859
3896
  };
3860
3897
  he.prototype.commaOnlyOnX0 = function () {
3861
3898
  return ", רק ב %s";
@@ -4590,7 +4627,7 @@ var it = (function () {
4590
4627
  return ", l'ultimo giorno del mese";
4591
4628
  };
4592
4629
  it.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
4593
- return ", nell'ultima settimana del mese";
4630
+ return ", l'ultimo giorno feriale del mese";
4594
4631
  };
4595
4632
  it.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
4596
4633
  return ", %s giorni prima dell'ultimo giorno del mese";
@@ -5215,7 +5252,7 @@ var my = (function () {
5215
5252
  return ", pada hari terakhir bulan";
5216
5253
  };
5217
5254
  my.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
5218
- return ", pada minggu terakhir bulan";
5255
+ return ", pada hari bekerja terakhir bulan";
5219
5256
  };
5220
5257
  my.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
5221
5258
  return ", %s hari sebelum hari terakhir bulan";
@@ -7741,7 +7778,7 @@ var sw = (function () {
7741
7778
  return "siku ya mwisho";
7742
7779
  };
7743
7780
  sw.prototype.commaOnTheLastX0OfTheMonth = function () {
7744
- return ", siku ya %s ya mwezi";
7781
+ return ", %s ya mwisho ya mwezi";
7745
7782
  };
7746
7783
  sw.prototype.commaOnlyOnX0 = function () {
7747
7784
  return ", kwa %s tu";
@@ -7759,7 +7796,7 @@ var sw = (function () {
7759
7796
  return ", siku ya mwisho wa mwezi";
7760
7797
  };
7761
7798
  sw.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
7762
- return ", wikendi ya mwisho wa mwezi";
7799
+ return ", siku ya kazi ya mwisho wa mwezi";
7763
7800
  };
7764
7801
  sw.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
7765
7802
  return ", siku ya %s kabla ya siku ya mwisho wa mwezi";
@@ -8378,7 +8415,7 @@ var tr = (function () {
8378
8415
  return "ilk iş günü";
8379
8416
  };
8380
8417
  tr.prototype.weekdayNearestDayX0 = function () {
8381
- return "%s. günü sonrasındaki ilk iş günü";
8418
+ return "%s. gününe en yakın iş günü";
8382
8419
  };
8383
8420
  tr.prototype.commaOnTheX0OfTheMonth = function () {
8384
8421
  return ", ayın %s";
@@ -8751,19 +8788,19 @@ var vi = (function () {
8751
8788
  return ", vào ngày cuối cùng của tháng";
8752
8789
  };
8753
8790
  vi.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
8754
- return ", vào ngày cuối tuần của tháng";
8791
+ return ", vào ngày làm việc cuối cùng của tháng";
8755
8792
  };
8756
8793
  vi.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
8757
8794
  return ", %s ngày trước ngày cuối cùng của tháng";
8758
8795
  };
8759
8796
  vi.prototype.firstWeekday = function () {
8760
- return "ngày đầu tuần";
8797
+ return "ngày làm việc đầu tiên";
8761
8798
  };
8762
8799
  vi.prototype.weekdayNearestDayX0 = function () {
8763
- return "ngày trong tuần ngày gần nhất %s";
8800
+ return "ngày làm việc gần ngày %s nhất";
8764
8801
  };
8765
8802
  vi.prototype.commaOnTheX0OfTheMonth = function () {
8766
- return ", vào ngày %s của tháng";
8803
+ return ", vào %s của tháng";
8767
8804
  };
8768
8805
  vi.prototype.commaEveryX0Days = function () {
8769
8806
  return ", mỗi %s ngày";
@@ -8963,7 +9000,7 @@ var zh_CN = (function () {
8963
9000
  return ", 限每月的最后一个工作日";
8964
9001
  };
8965
9002
  zh_CN.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
8966
- return ", 限每月最后%s天";
9003
+ return ", 限每月最后一天之前的第%s天";
8967
9004
  };
8968
9005
  zh_CN.prototype.firstWeekday = function () {
8969
9006
  return "第一个工作日";
@@ -9150,7 +9187,7 @@ var zh_TW = (function () {
9150
9187
  return ", 每月的最後一個工作日";
9151
9188
  };
9152
9189
  zh_TW.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
9153
- return ", %s 這個月的最後一天的前幾天";
9190
+ return ", 每月最後一天之前的第 %s 天";
9154
9191
  };
9155
9192
  zh_TW.prototype.firstWeekday = function () {
9156
9193
  return "第一個工作日";