@syncfusion/ej2-calendars 20.4.42 → 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.
@@ -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;
@@ -9140,6 +9153,17 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9140
9153
  this.updateHeader();
9141
9154
  }
9142
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
+ }
9143
9167
  /**
9144
9168
  * Called internally if any of the property value changed.
9145
9169
  *
@@ -9228,7 +9252,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9228
9252
  newProp.startDate = this.globalize.parseDate(newProp.startDate, format);
9229
9253
  }
9230
9254
  if (+this.initStartDate !== +newProp.startDate) {
9231
- this.startValue = this.checkDateValue(new Date(this.checkValue(newProp.startDate)));
9255
+ this.startValue = this.getStartEndValue(newProp.startDate, false);
9232
9256
  this.setDate();
9233
9257
  this.setValue();
9234
9258
  }
@@ -9238,7 +9262,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9238
9262
  newProp.endDate = this.globalize.parseDate(newProp.endDate, format);
9239
9263
  }
9240
9264
  if (+this.initEndDate !== +newProp.endDate) {
9241
- this.endValue = this.checkDateValue(new Date(this.checkValue(newProp.endDate)));
9265
+ this.endValue = this.getStartEndValue(newProp.endDate, true);
9242
9266
  this.setDate();
9243
9267
  this.setValue();
9244
9268
  }