@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.
@@ -5830,7 +5830,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5830
5830
  this.createControl();
5831
5831
  this.bindCalendarEvents();
5832
5832
  this.updateRange((this.isMobile ? [this.calendarElement] : [this.leftCalendar, this.rightCalendar]));
5833
- if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue)) {
5833
+ if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.renderDayCell)) {
5834
5834
  this.disabledDateRender();
5835
5835
  }
5836
5836
  this.updateHeader();
@@ -6001,8 +6001,10 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6001
6001
  if (range.length > 1) {
6002
6002
  this.invalidValueString = null;
6003
6003
  const dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
6004
- const startDate = this.globalize.parseDate(range[0].trim(), dateOptions);
6005
- const endDate = this.globalize.parseDate(range[1].trim(), dateOptions);
6004
+ const start = new Date(range[0]);
6005
+ const end = new Date(range[1]);
6006
+ const startDate = this.getStartEndDate(start, false, range, dateOptions);
6007
+ const endDate = this.getStartEndDate(end, true, range, dateOptions);
6006
6008
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
6007
6009
  const prevStartVal = this.startValue;
6008
6010
  this.startValue = startDate;
@@ -6074,6 +6076,17 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6074
6076
  }
6075
6077
  this.updateHiddenInput();
6076
6078
  }
6079
+ getStartEndDate(date, isEnd, range, dateOptions) {
6080
+ if (this.depth === 'Month') {
6081
+ return this.globalize.parseDate(range[isEnd ? 1 : 0].trim(), dateOptions);
6082
+ }
6083
+ else if (this.depth === 'Year') {
6084
+ return new Date(date.getFullYear(), date.getMonth() + (isEnd ? 1 : 0), isEnd ? 0 : 1);
6085
+ }
6086
+ else {
6087
+ return new Date(date.getFullYear(), isEnd ? 11 : 0, isEnd ? 31 : 1);
6088
+ }
6089
+ }
6077
6090
  clearRange() {
6078
6091
  this.previousStartValue = this.previousEndValue = null;
6079
6092
  this.currentDate = null;
@@ -6826,7 +6839,9 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6826
6839
  if (!this.isMobile) {
6827
6840
  this.removeClassDisabled();
6828
6841
  }
6829
- this.disabledDateRender();
6842
+ if (!isNullOrUndefined(this.renderDayCell)) {
6843
+ this.disabledDateRender();
6844
+ }
6830
6845
  this.trigger('select', this.rangeArgs(event));
6831
6846
  }
6832
6847
  else if (+date < +this.startValue) {
@@ -8393,7 +8408,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8393
8408
  if (!this.strictMode && (isDisabled)) {
8394
8409
  this.clearRange();
8395
8410
  }
8396
- if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isDisabled) {
8411
+ if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isDisabled && !isNullOrUndefined(this.renderDayCell)) {
8397
8412
  this.disabledDateRender();
8398
8413
  }
8399
8414
  this.errorClass();
@@ -8886,7 +8901,9 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8886
8901
  if (!isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.endValue)) {
8887
8902
  range = (Math.round(Math.abs((this.removeTimeValueFromDate(this.startValue).getTime() -
8888
8903
  this.removeTimeValueFromDate(this.endValue).getTime()) / (1000 * 60 * 60 * 24))) + 1);
8889
- this.disabledDateRender();
8904
+ if (!isNullOrUndefined(this.renderDayCell)) {
8905
+ this.disabledDateRender();
8906
+ }
8890
8907
  if (!isNullOrUndefined(this.disabledDayCnt)) {
8891
8908
  range = range - this.disabledDayCnt;
8892
8909
  this.disabledDayCnt = null;
@@ -9136,6 +9153,17 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9136
9153
  this.updateHeader();
9137
9154
  }
9138
9155
  }
9156
+ getStartEndValue(date, isEnd) {
9157
+ if (this.depth === 'Month') {
9158
+ return this.checkDateValue(new Date(this.checkValue(date)));
9159
+ }
9160
+ else if (this.depth === 'Year') {
9161
+ return new Date(date.getFullYear(), date.getMonth() + (isEnd ? 1 : 0), isEnd ? 0 : 1);
9162
+ }
9163
+ else {
9164
+ return new Date(date.getFullYear(), isEnd ? 11 : 0, isEnd ? 31 : 1);
9165
+ }
9166
+ }
9139
9167
  /**
9140
9168
  * Called internally if any of the property value changed.
9141
9169
  *
@@ -9224,7 +9252,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9224
9252
  newProp.startDate = this.globalize.parseDate(newProp.startDate, format);
9225
9253
  }
9226
9254
  if (+this.initStartDate !== +newProp.startDate) {
9227
- this.startValue = this.checkDateValue(new Date(this.checkValue(newProp.startDate)));
9255
+ this.startValue = this.getStartEndValue(newProp.startDate, false);
9228
9256
  this.setDate();
9229
9257
  this.setValue();
9230
9258
  }
@@ -9234,7 +9262,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9234
9262
  newProp.endDate = this.globalize.parseDate(newProp.endDate, format);
9235
9263
  }
9236
9264
  if (+this.initEndDate !== +newProp.endDate) {
9237
- this.endValue = this.checkDateValue(new Date(this.checkValue(newProp.endDate)));
9265
+ this.endValue = this.getStartEndValue(newProp.endDate, true);
9238
9266
  this.setDate();
9239
9267
  this.setValue();
9240
9268
  }