@wernfried/daterangepicker 5.3.7 → 5.4.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.
@@ -87,7 +87,7 @@ var DateRangePicker = (function(exports, luxon2) {
87
87
  dataOptions[name] = ts.isValid && isDate ? ts : JSON.parse(item.value);
88
88
  }
89
89
  options = { ...dataOptions, ...options };
90
- if (["string", "object"].includes(typeof options.button)) {
90
+ if (["string", "object"].includes(typeof options.button) && options.button != null) {
91
91
  let button = options.button;
92
92
  if (typeof button === "string" && document.querySelectorAll(button).length === 1)
93
93
  button = document.querySelector(button);
@@ -178,7 +178,7 @@ var DateRangePicker = (function(exports, luxon2) {
178
178
  else
179
179
  console.error(`Option 'locale.direction' must be 'rtl' or 'ltr'`);
180
180
  }
181
- if (["string", "object"].includes(typeof options.locale.format))
181
+ if (["string", "object"].includes(typeof options.locale.format) && options.locale.format !== null)
182
182
  this.locale.format = options.locale.format;
183
183
  if (Array.isArray(options.locale.daysOfWeek)) {
184
184
  if (options.locale.daysOfWeek.some((x) => typeof x !== "string"))
@@ -315,12 +315,12 @@ var DateRangePicker = (function(exports, luxon2) {
315
315
  if (opt === "endDate" && this.singleDatePicker)
316
316
  continue;
317
317
  if (typeof options[opt] === "object") {
318
- if (luxon2.DateTime.isDateTime(options[opt]) && options[opt].isValid) {
318
+ if (options[opt] == null) {
319
+ this[opt] = null;
320
+ } else if (luxon2.DateTime.isDateTime(options[opt])) {
319
321
  this[opt] = options[opt];
320
322
  } else if (options[opt] instanceof Date) {
321
323
  this[opt] = luxon2.DateTime.fromJSDate(options[opt]);
322
- } else if (options[opt] === null) {
323
- this[opt] = null;
324
324
  } else {
325
325
  console.error(`Option '${opt}' must be a luxon.DateTime or Date or string`);
326
326
  }
@@ -458,7 +458,7 @@ var DateRangePicker = (function(exports, luxon2) {
458
458
  iterator--;
459
459
  }
460
460
  }
461
- if (!this.singleDatePicker && typeof options.ranges === "object") {
461
+ if (!this.singleDatePicker && typeof options.ranges === "object" && options.ranges != null) {
462
462
  for (let range in options.ranges) {
463
463
  let start, end;
464
464
  if (["string", "object"].includes(typeof options.ranges[range][0])) {
@@ -617,7 +617,7 @@ var DateRangePicker = (function(exports, luxon2) {
617
617
  * // -> Calendar selects and shows "today - 3 days"
618
618
  */
619
619
  onViolate: { type: "violate", param: (violation, newDate) => {
620
- return { ...violation, ...{ cancelable: true } };
620
+ return { ...violation, cancelable: true };
621
621
  } },
622
622
  /**
623
623
  * Emitted before the calendar time picker is rendered.
@@ -1335,7 +1335,7 @@ var DateRangePicker = (function(exports, luxon2) {
1335
1335
  html += `<th class="week">${this.locale.weekLabel}</th>`;
1336
1336
  for (let [index, dayOfWeek] of this.locale.daysOfWeek.entries()) {
1337
1337
  html += "<th";
1338
- if (this.weekendDayClasses && this.weekendDayClasses.length && luxon2.Info.getWeekendWeekdays().includes(index + 1))
1338
+ if (this.weekendDayClasses && this.weekendDayClasses.length && luxon2.Info.getWeekendWeekdays().includes(calendar[0][index].weekday))
1339
1339
  html += ` class="${this.weekendDayClasses}"`;
1340
1340
  html += `>${dayOfWeek}</th>`;
1341
1341
  }