@gravitee/ui-particles-angular 17.7.0 → 17.7.1

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.
@@ -4809,10 +4809,41 @@ const toCronExpression = (cronDisplay) => {
4809
4809
  const toCronDescription = (cronExpression) => {
4810
4810
  throwIfInvalid(cronExpression);
4811
4811
  if (!isEmpty(cronExpression)) {
4812
- return Cronstrue.toString(cronExpression);
4812
+ return Cronstrue.toString(expandMisleadingSteps(cronExpression));
4813
4813
  }
4814
4814
  return '';
4815
4815
  };
4816
+ /**
4817
+ * Expand step values (like *\/50) that don't evenly divide the field range
4818
+ * into explicit value lists (like 0,50) so that cronstrue generates an accurate description.
4819
+ *
4820
+ * For example, *\/50 in the minutes field means "at every minute divisible by 50" (i.e. 0 and 50),
4821
+ * NOT "every 50 minutes". Without this fix, cronstrue would display "Every 50 minutes" which is misleading.
4822
+ *
4823
+ * See: https://github.com/bradymholt/cRonstrue/issues/360
4824
+ */
4825
+ const expandMisleadingSteps = (cronExpression) => {
4826
+ const parts = cronExpression.trim().split(/\s+/);
4827
+ // Field ranges: [seconds, minutes, hours, day-of-month, month, day-of-week]
4828
+ const fieldRanges = [60, 60, 24, undefined, undefined, undefined];
4829
+ const expandedParts = parts.map((part, index) => {
4830
+ const range = fieldRanges[index];
4831
+ if (range === undefined)
4832
+ return part;
4833
+ const match = part.match(/^\*\/(\d+)$/);
4834
+ if (!match)
4835
+ return part;
4836
+ const step = parseInt(match[1], 10);
4837
+ if (step <= 0 || range % step === 0)
4838
+ return part;
4839
+ const values = [];
4840
+ for (let v = 0; v < range; v += step) {
4841
+ values.push(v);
4842
+ }
4843
+ return values.join(',');
4844
+ });
4845
+ return expandedParts.join(' ');
4846
+ };
4816
4847
  /**
4817
4848
  * Simple validation to ensure that the cron expression has 6 parts.
4818
4849
  * Note : The full cron expression validation is done by the backend.