@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.
@@ -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;
@@ -9233,6 +9246,17 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9233
9246
  this.updateHeader();
9234
9247
  }
9235
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
+ };
9236
9260
  /**
9237
9261
  * Called internally if any of the property value changed.
9238
9262
  *
@@ -9322,7 +9346,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9322
9346
  newProp.startDate = this.globalize.parseDate(newProp.startDate, format);
9323
9347
  }
9324
9348
  if (+this.initStartDate !== +newProp.startDate) {
9325
- this.startValue = this.checkDateValue(new Date(this.checkValue(newProp.startDate)));
9349
+ this.startValue = this.getStartEndValue(newProp.startDate, false);
9326
9350
  this.setDate();
9327
9351
  this.setValue();
9328
9352
  }
@@ -9332,7 +9356,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9332
9356
  newProp.endDate = this.globalize.parseDate(newProp.endDate, format);
9333
9357
  }
9334
9358
  if (+this.initEndDate !== +newProp.endDate) {
9335
- this.endValue = this.checkDateValue(new Date(this.checkValue(newProp.endDate)));
9359
+ this.endValue = this.getStartEndValue(newProp.endDate, true);
9336
9360
  this.setDate();
9337
9361
  this.setValue();
9338
9362
  }