@syncfusion/ej2-calendars 20.4.40 → 20.4.44

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.
@@ -5904,7 +5904,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
5904
5904
  this.createControl();
5905
5905
  this.bindCalendarEvents();
5906
5906
  this.updateRange((this.isMobile ? [this.calendarElement] : [this.leftCalendar, this.rightCalendar]));
5907
- if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue)) {
5907
+ if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.renderDayCell)) {
5908
5908
  this.disabledDateRender();
5909
5909
  }
5910
5910
  this.updateHeader();
@@ -6075,8 +6075,10 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6075
6075
  if (range.length > 1) {
6076
6076
  this.invalidValueString = null;
6077
6077
  var dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
6078
- var startDate = this.globalize.parseDate(range[0].trim(), dateOptions);
6079
- var endDate = this.globalize.parseDate(range[1].trim(), dateOptions);
6078
+ var start = new Date(range[0]);
6079
+ var end = new Date(range[1]);
6080
+ var startDate = this.getStartEndDate(start, false, range, dateOptions);
6081
+ var endDate = this.getStartEndDate(end, true, range, dateOptions);
6080
6082
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
6081
6083
  var prevStartVal = this.startValue;
6082
6084
  this.startValue = startDate;
@@ -6148,6 +6150,17 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6148
6150
  }
6149
6151
  this.updateHiddenInput();
6150
6152
  };
6153
+ DateRangePicker.prototype.getStartEndDate = function (date, isEnd, range, dateOptions) {
6154
+ if (this.depth === 'Month') {
6155
+ return this.globalize.parseDate(range[isEnd ? 1 : 0].trim(), dateOptions);
6156
+ }
6157
+ else if (this.depth === 'Year') {
6158
+ return new Date(date.getFullYear(), date.getMonth() + (isEnd ? 1 : 0), isEnd ? 0 : 1);
6159
+ }
6160
+ else {
6161
+ return new Date(date.getFullYear(), isEnd ? 11 : 0, isEnd ? 31 : 1);
6162
+ }
6163
+ };
6151
6164
  DateRangePicker.prototype.clearRange = function () {
6152
6165
  this.previousStartValue = this.previousEndValue = null;
6153
6166
  this.currentDate = null;
@@ -6908,7 +6921,9 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6908
6921
  if (!this.isMobile) {
6909
6922
  this.removeClassDisabled();
6910
6923
  }
6911
- this.disabledDateRender();
6924
+ if (!isNullOrUndefined(this.renderDayCell)) {
6925
+ this.disabledDateRender();
6926
+ }
6912
6927
  this.trigger('select', this.rangeArgs(event));
6913
6928
  }
6914
6929
  else if (+date < +this.startValue) {
@@ -8484,7 +8499,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8484
8499
  if (!this.strictMode && (isDisabled)) {
8485
8500
  this.clearRange();
8486
8501
  }
8487
- if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isDisabled) {
8502
+ if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isDisabled && !isNullOrUndefined(this.renderDayCell)) {
8488
8503
  this.disabledDateRender();
8489
8504
  }
8490
8505
  this.errorClass();
@@ -8977,7 +8992,9 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8977
8992
  if (!isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.endValue)) {
8978
8993
  range = (Math.round(Math.abs((this.removeTimeValueFromDate(this.startValue).getTime() -
8979
8994
  this.removeTimeValueFromDate(this.endValue).getTime()) / (1000 * 60 * 60 * 24))) + 1);
8980
- this.disabledDateRender();
8995
+ if (!isNullOrUndefined(this.renderDayCell)) {
8996
+ this.disabledDateRender();
8997
+ }
8981
8998
  if (!isNullOrUndefined(this.disabledDayCnt)) {
8982
8999
  range = range - this.disabledDayCnt;
8983
9000
  this.disabledDayCnt = null;
@@ -9229,6 +9246,17 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9229
9246
  this.updateHeader();
9230
9247
  }
9231
9248
  };
9249
+ DateRangePicker.prototype.getStartEndValue = function (date, isEnd) {
9250
+ if (this.depth === 'Month') {
9251
+ return this.checkDateValue(new Date(this.checkValue(date)));
9252
+ }
9253
+ else if (this.depth === 'Year') {
9254
+ return new Date(date.getFullYear(), date.getMonth() + (isEnd ? 1 : 0), isEnd ? 0 : 1);
9255
+ }
9256
+ else {
9257
+ return new Date(date.getFullYear(), isEnd ? 11 : 0, isEnd ? 31 : 1);
9258
+ }
9259
+ };
9232
9260
  /**
9233
9261
  * Called internally if any of the property value changed.
9234
9262
  *
@@ -9318,7 +9346,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9318
9346
  newProp.startDate = this.globalize.parseDate(newProp.startDate, format);
9319
9347
  }
9320
9348
  if (+this.initStartDate !== +newProp.startDate) {
9321
- this.startValue = this.checkDateValue(new Date(this.checkValue(newProp.startDate)));
9349
+ this.startValue = this.getStartEndValue(newProp.startDate, false);
9322
9350
  this.setDate();
9323
9351
  this.setValue();
9324
9352
  }
@@ -9328,7 +9356,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9328
9356
  newProp.endDate = this.globalize.parseDate(newProp.endDate, format);
9329
9357
  }
9330
9358
  if (+this.initEndDate !== +newProp.endDate) {
9331
- this.endValue = this.checkDateValue(new Date(this.checkValue(newProp.endDate)));
9359
+ this.endValue = this.getStartEndValue(newProp.endDate, true);
9332
9360
  this.setDate();
9333
9361
  this.setValue();
9334
9362
  }