@syncfusion/ej2-calendars 28.1.37 → 28.1.41

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.
@@ -6294,10 +6294,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6294
6294
  if (range.length > 1) {
6295
6295
  this.invalidValueString = null;
6296
6296
  const dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
6297
- const start = this.globalize.parseDate(this.getAmPmValue(range[0]), dateOptions);
6298
- const end = this.globalize.parseDate(this.getAmPmValue(range[1]), dateOptions);
6299
- const startDate = this.getStartEndDate(start, false, range, dateOptions);
6300
- const endDate = this.getStartEndDate(end, true, range, dateOptions);
6297
+ const startDate = this.globalize.parseDate(this.getAmPmValue(range[0]).trim(), dateOptions);
6298
+ const endDate = this.globalize.parseDate(this.getAmPmValue(range[1]).trim(), dateOptions);
6301
6299
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
6302
6300
  const prevStartVal = this.startValue;
6303
6301
  this.startValue = startDate;
@@ -6369,14 +6367,11 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6369
6367
  }
6370
6368
  this.updateHiddenInput();
6371
6369
  }
6372
- getStartEndDate(date, isEnd, range, dateOptions) {
6373
- if (this.depth === 'Month') {
6374
- return this.globalize.parseDate(this.getAmPmValue(range[isEnd ? 1 : 0]).trim(), dateOptions);
6375
- }
6376
- else if (this.depth === 'Year' && !isNullOrUndefined(date)) {
6370
+ getStartEndDate(date, isEnd) {
6371
+ if (this.currentView() === 'Year' && !isNullOrUndefined(date)) {
6377
6372
  return new Date(date.getFullYear(), date.getMonth() + (isEnd ? 1 : 0), isEnd ? 0 : 1);
6378
6373
  }
6379
- else if (!isNullOrUndefined(date)) {
6374
+ else if (this.currentView() === 'Decade' && !isNullOrUndefined(date)) {
6380
6375
  return new Date(date.getFullYear(), isEnd ? 11 : 0, isEnd ? 31 : 1);
6381
6376
  }
6382
6377
  else {
@@ -6865,7 +6860,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6865
6860
  const isDisabledCell = (!ele.classList.contains(DISABLED$2) || ele.classList.contains(DATEDISABLED));
6866
6861
  if (!ele.classList.contains(WEEKNUMBER$2) && isDisabledCell) {
6867
6862
  const eleDate = this.getIdValue(null, ele);
6868
- const startDateValue = new Date(+this.startValue);
6863
+ const startDateValue = this.currentView() === 'Month' ? new Date(+this.startValue) : this.getStartEndDate(new Date(+this.startValue), false);
6869
6864
  const eleDateValue = new Date(+eleDate);
6870
6865
  if (eleDateValue.setHours(0, 0, 0, 0) >= startDateValue.setHours(0, 0, 0, 0) && +eleDate <= +currentDate) {
6871
6866
  addClass([ele], RANGEHOVER);
@@ -6907,9 +6902,11 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6907
6902
  const eleDate = this.getIdValue(null, ele);
6908
6903
  const eleDateValue = this.getIdValue(null, ele);
6909
6904
  if (!isNullOrUndefined(this.endValue)) {
6905
+ const eleStartDateValue = this.currentView() === 'Month' ? new Date(+this.startValue) : this.getStartEndDate(new Date(+this.startValue), false);
6906
+ const eleEndDateValue = this.currentView() === 'Month' ? new Date(+this.endValue) : this.getStartEndDate(new Date(+this.endValue), true);
6910
6907
  if (this.currentView() === this.depth &&
6911
- +eleDateValue.setHours(0, 0, 0, 0) >= +new Date(+this.startValue).setHours(0, 0, 0, 0)
6912
- && +eleDateValue.setHours(0, 0, 0, 0) <= +new Date(+this.endValue).setHours(0, 0, 0, 0) &&
6908
+ +eleDateValue.setHours(0, 0, 0, 0) >= +eleStartDateValue.setHours(0, 0, 0, 0)
6909
+ && +eleDateValue.setHours(0, 0, 0, 0) <= +eleEndDateValue.setHours(0, 0, 0, 0) &&
6913
6910
  !this.isSameStartEnd(new Date(+this.startValue), new Date(+this.endValue)) &&
6914
6911
  +new Date(+this.startValue).setHours(0, 0, 0, 0) >= +this.min
6915
6912
  && +new Date(+this.endValue).setHours(0, 0, 0, 0) <= +this.max
@@ -6929,7 +6926,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6929
6926
  removeClass([ele], [RANGEHOVER]);
6930
6927
  }
6931
6928
  if (!ele.classList.contains(OTHERMONTH$2)) {
6932
- const startDateValue = new Date(+this.startValue);
6929
+ const startDateValue = this.currentView() === 'Month' ? new Date(+this.startValue) : this.getStartEndDate(new Date(+this.startValue), false);
6933
6930
  let eleDateValue = new Date(+eleDate);
6934
6931
  if (this.currentView() === this.depth &&
6935
6932
  +eleDateValue.setHours(0, 0, 0, 0) === +startDateValue.setHours(0, 0, 0, 0)
@@ -6940,7 +6937,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6940
6937
  addClass([ele], [STARTDATE, SELECTED$3]);
6941
6938
  this.addSelectedAttributes(ele, this.startValue, true);
6942
6939
  }
6943
- const endDateValue = new Date(+this.endValue);
6940
+ const endDateValue = this.currentView() === 'Month' ? new Date(+this.endValue) : this.getStartEndDate(new Date(+this.endValue), true);
6944
6941
  if (this.currentView() === 'Year') {
6945
6942
  eleDateValue = new Date(eleDateValue.getFullYear(), eleDateValue.getMonth() + 1, 0);
6946
6943
  }
@@ -7033,14 +7030,36 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
7033
7030
  if (event) {
7034
7031
  event.preventDefault();
7035
7032
  }
7036
- const date = isNullOrUndefined(event) ? this.getIdValue(null, element)
7033
+ let isValue;
7034
+ let startDateValue;
7035
+ let endDateValue;
7036
+ const value = this.inputElement.value;
7037
+ if (!isNullOrUndefined(value) && value.trim() !== '') {
7038
+ const range = value.split(' ' + this.separator + ' ');
7039
+ if (range.length > 1 && ((this.currentView() === 'Year' && this.depth === 'Year')
7040
+ || (this.currentView() === 'Decade' && this.depth === 'Decade'))) {
7041
+ const dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
7042
+ startDateValue = this.globalize.parseDate(this.getAmPmValue(range[0]).trim(), dateOptions);
7043
+ endDateValue = this.globalize.parseDate(this.getAmPmValue(range[1]).trim(), dateOptions);
7044
+ isValue = true;
7045
+ }
7046
+ }
7047
+ let date = isNullOrUndefined(event) ? this.getIdValue(null, element)
7037
7048
  : this.getIdValue(event, null);
7049
+ if (!isNullOrUndefined(this.startValue)) {
7050
+ if (this.currentView() === 'Year' && this.depth === 'Year') {
7051
+ date = new Date(date.getFullYear(), date.getMonth(), this.startValue.getDate());
7052
+ }
7053
+ else if (this.currentView() === 'Decade' && this.depth === 'Decade') {
7054
+ date = new Date(date.getFullYear(), this.startValue.getMonth(), this.startValue.getDate());
7055
+ }
7056
+ }
7038
7057
  const y = date.getFullYear();
7039
7058
  const m = date.getMonth();
7040
- const firstDay = new Date(y, m, 1);
7041
- const lastDay = new Date(y, m + 1, 0);
7042
- const firstMonth = new Date(y, 0, 1);
7043
- const lastMonth = new Date(y, 11, 31);
7059
+ const firstDay = isValue ? new Date(y, m, startDateValue.getDate(), startDateValue.getHours(), startDateValue.getMinutes(), startDateValue.getSeconds()) : new Date(y, m, 1);
7060
+ const lastDay = isValue ? new Date(y, m, endDateValue.getDate(), endDateValue.getHours(), endDateValue.getMinutes(), endDateValue.getSeconds()) : new Date(y, m + 1, 0);
7061
+ const firstMonth = isValue ? new Date(y, startDateValue.getMonth(), startDateValue.getDate(), startDateValue.getHours(), startDateValue.getMinutes(), startDateValue.getSeconds()) : new Date(y, 0, 1);
7062
+ const lastMonth = isValue ? new Date(y, endDateValue.getMonth(), endDateValue.getDate(), endDateValue.getHours(), endDateValue.getMinutes(), endDateValue.getSeconds()) : new Date(y, 11, 31);
7044
7063
  if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue)) {
7045
7064
  if (!this.isMobile || this.isMobile && !this.endButton.element.classList.contains(ACTIVE$1)) {
7046
7065
  this.removeSelection();
@@ -14628,7 +14647,8 @@ class MaskedDateTime {
14628
14647
  return;
14629
14648
  }
14630
14649
  this.isDayPart = true;
14631
- this.dayTypeCount = this.dayTypeCount + 1;
14650
+ const maxDaysInMonth = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
14651
+ this.dayTypeCount += (this.dayTypeCount === 0 && (parseInt(date + '0', 10) > maxDaysInMonth)) ? 2 : 1;
14632
14652
  }
14633
14653
  else {
14634
14654
  this.isDayPart = false;
@@ -14750,7 +14770,7 @@ class MaskedDateTime {
14750
14770
  newDateValue.setHours(Math.floor(newDateValue.getHours() / 12) * 12 + (this.hour % 12));
14751
14771
  this.isNavigate = this.hour.toString().length === 2;
14752
14772
  this.isHourPart = true;
14753
- this.hourTypeCount = this.hourTypeCount + 1;
14773
+ this.hourTypeCount = (this.hourTypeCount === 0 && this.hour && (parseInt(this.hour + '0', 10) > 12)) ? 2 : this.hourTypeCount + 1;
14754
14774
  break;
14755
14775
  case 'H':
14756
14776
  this.hour = (this.isHourPart && newDateValue.getHours().toString().length < 2 &&
@@ -14766,7 +14786,7 @@ class MaskedDateTime {
14766
14786
  newDateValue.setHours(this.hour);
14767
14787
  this.isNavigate = this.hour.toString().length === 2;
14768
14788
  this.isHourPart = true;
14769
- this.hourTypeCount = this.hourTypeCount + 1;
14789
+ this.hourTypeCount = (this.hourTypeCount === 0 && this.hour && (parseInt(this.hour + '0', 10) > 23)) ? 2 : this.hourTypeCount + 1;
14770
14790
  break;
14771
14791
  case 'm':
14772
14792
  {
@@ -14783,7 +14803,7 @@ class MaskedDateTime {
14783
14803
  newDateValue.setMinutes(minutes);
14784
14804
  this.isNavigate = minutes.toString().length === 2;
14785
14805
  this.isMinutePart = true;
14786
- this.minuteTypeCount = this.minuteTypeCount + 1;
14806
+ this.minuteTypeCount = (this.minuteTypeCount === 0 && (parseInt(minutes + '0', 10) > 59)) ? 2 : this.minuteTypeCount + 1;
14787
14807
  break;
14788
14808
  }
14789
14809
  case 's':
@@ -14801,7 +14821,7 @@ class MaskedDateTime {
14801
14821
  newDateValue.setSeconds(seconds);
14802
14822
  this.isNavigate = seconds.toString().length === 2;
14803
14823
  this.isSecondsPart = true;
14804
- this.secondTypeCount = this.secondTypeCount + 1;
14824
+ this.secondTypeCount = (this.secondTypeCount === 0 && (parseInt(seconds + '0', 10) > 59)) ? 2 : this.secondTypeCount + 1;
14805
14825
  break;
14806
14826
  }
14807
14827
  case 'a':