cronstrue 3.3.0 → 3.9.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.
package/README.md CHANGED
@@ -125,6 +125,7 @@ An options object can be passed as the second parameter to `cronstrue.toString`.
125
125
  - **monthStartIndexZero: boolean** - Whether to interpret January as `0` or `1`. (Default: false)
126
126
  - **use24HourTimeFormat: boolean** - If true, descriptions will use a [24-hour clock](https://en.wikipedia.org/wiki/24-hour_clock) (Default: false but some translations will default to true)
127
127
  - **locale: string** - The locale to use (Default: "en")
128
+ - **logicalAndDayFields: boolean** - If true, descriptions for cron expressions with both day of month and day of week specified will follow a logical-AND wording rather than logical-OR wording; e.g. "...between day 11 and 17 of the month, only on Friday" rather than "...between day 11 and 17 of the month, and on Friday" (Default: false)
128
129
 
129
130
  ## i18n
130
131
 
@@ -287,7 +287,7 @@ var ExpressionDescriptor = (function () {
287
287
  }
288
288
  }
289
289
  ExpressionDescriptor.toString = function (expression, _a) {
290
- var _b = _a === void 0 ? {} : _a, _c = _b.throwExceptionOnParseError, throwExceptionOnParseError = _c === void 0 ? true : _c, _d = _b.verbose, verbose = _d === void 0 ? false : _d, _e = _b.dayOfWeekStartIndexZero, dayOfWeekStartIndexZero = _e === void 0 ? true : _e, _f = _b.monthStartIndexZero, monthStartIndexZero = _f === void 0 ? false : _f, use24HourTimeFormat = _b.use24HourTimeFormat, _g = _b.locale, locale = _g === void 0 ? null : _g;
290
+ var _b = _a === void 0 ? {} : _a, _c = _b.throwExceptionOnParseError, throwExceptionOnParseError = _c === void 0 ? true : _c, _d = _b.verbose, verbose = _d === void 0 ? false : _d, _e = _b.dayOfWeekStartIndexZero, dayOfWeekStartIndexZero = _e === void 0 ? true : _e, _f = _b.monthStartIndexZero, monthStartIndexZero = _f === void 0 ? false : _f, use24HourTimeFormat = _b.use24HourTimeFormat, _g = _b.locale, locale = _g === void 0 ? null : _g, _h = _b.logicalAndDayFields, logicalAndDayFields = _h === void 0 ? false : _h;
291
291
  var options = {
292
292
  throwExceptionOnParseError: throwExceptionOnParseError,
293
293
  verbose: verbose,
@@ -295,6 +295,7 @@ var ExpressionDescriptor = (function () {
295
295
  monthStartIndexZero: monthStartIndexZero,
296
296
  use24HourTimeFormat: use24HourTimeFormat,
297
297
  locale: locale,
298
+ logicalAndDayFields: logicalAndDayFields,
298
299
  };
299
300
  if (options.tzOffset) {
300
301
  console.warn("'tzOffset' option has been deprecated and is no longer supported.");
@@ -529,7 +530,15 @@ var ExpressionDescriptor = (function () {
529
530
  }
530
531
  else {
531
532
  var domSpecified = _this.expressionParts[3] != "*";
532
- format = domSpecified ? _this.i18n.commaAndOnX0() : _this.i18n.commaOnlyOnX0(s);
533
+ if (!domSpecified) {
534
+ format = _this.i18n.commaOnlyOnX0(s);
535
+ }
536
+ else if (_this.options.logicalAndDayFields) {
537
+ format = _this.i18n.commaOnlyOnX0(s);
538
+ }
539
+ else {
540
+ format = _this.i18n.commaAndOnX0();
541
+ }
533
542
  }
534
543
  return format;
535
544
  });