@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.
@@ -6370,10 +6370,8 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6370
6370
  if (range.length > 1) {
6371
6371
  this.invalidValueString = null;
6372
6372
  var dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
6373
- var start = this.globalize.parseDate(this.getAmPmValue(range[0]), dateOptions);
6374
- var end = this.globalize.parseDate(this.getAmPmValue(range[1]), dateOptions);
6375
- var startDate = this.getStartEndDate(start, false, range, dateOptions);
6376
- var endDate = this.getStartEndDate(end, true, range, dateOptions);
6373
+ var startDate = this.globalize.parseDate(this.getAmPmValue(range[0]).trim(), dateOptions);
6374
+ var endDate = this.globalize.parseDate(this.getAmPmValue(range[1]).trim(), dateOptions);
6377
6375
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
6378
6376
  var prevStartVal = this.startValue;
6379
6377
  this.startValue = startDate;
@@ -6445,14 +6443,11 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6445
6443
  }
6446
6444
  this.updateHiddenInput();
6447
6445
  };
6448
- DateRangePicker.prototype.getStartEndDate = function (date, isEnd, range, dateOptions) {
6449
- if (this.depth === 'Month') {
6450
- return this.globalize.parseDate(this.getAmPmValue(range[isEnd ? 1 : 0]).trim(), dateOptions);
6451
- }
6452
- else if (this.depth === 'Year' && !isNullOrUndefined(date)) {
6446
+ DateRangePicker.prototype.getStartEndDate = function (date, isEnd) {
6447
+ if (this.currentView() === 'Year' && !isNullOrUndefined(date)) {
6453
6448
  return new Date(date.getFullYear(), date.getMonth() + (isEnd ? 1 : 0), isEnd ? 0 : 1);
6454
6449
  }
6455
- else if (!isNullOrUndefined(date)) {
6450
+ else if (this.currentView() === 'Decade' && !isNullOrUndefined(date)) {
6456
6451
  return new Date(date.getFullYear(), isEnd ? 11 : 0, isEnd ? 31 : 1);
6457
6452
  }
6458
6453
  else {
@@ -6945,7 +6940,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6945
6940
  var isDisabledCell = (!ele.classList.contains(DISABLED$2) || ele.classList.contains(DATEDISABLED));
6946
6941
  if (!ele.classList.contains(WEEKNUMBER$2) && isDisabledCell) {
6947
6942
  var eleDate = this.getIdValue(null, ele);
6948
- var startDateValue = new Date(+this.startValue);
6943
+ var startDateValue = this.currentView() === 'Month' ? new Date(+this.startValue) : this.getStartEndDate(new Date(+this.startValue), false);
6949
6944
  var eleDateValue = new Date(+eleDate);
6950
6945
  if (eleDateValue.setHours(0, 0, 0, 0) >= startDateValue.setHours(0, 0, 0, 0) && +eleDate <= +currentDate) {
6951
6946
  addClass([ele], RANGEHOVER);
@@ -6989,9 +6984,11 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6989
6984
  var eleDate = this.getIdValue(null, ele);
6990
6985
  var eleDateValue = this.getIdValue(null, ele);
6991
6986
  if (!isNullOrUndefined(this.endValue)) {
6987
+ var eleStartDateValue = this.currentView() === 'Month' ? new Date(+this.startValue) : this.getStartEndDate(new Date(+this.startValue), false);
6988
+ var eleEndDateValue = this.currentView() === 'Month' ? new Date(+this.endValue) : this.getStartEndDate(new Date(+this.endValue), true);
6992
6989
  if (this.currentView() === this.depth &&
6993
- +eleDateValue.setHours(0, 0, 0, 0) >= +new Date(+this.startValue).setHours(0, 0, 0, 0)
6994
- && +eleDateValue.setHours(0, 0, 0, 0) <= +new Date(+this.endValue).setHours(0, 0, 0, 0) &&
6990
+ +eleDateValue.setHours(0, 0, 0, 0) >= +eleStartDateValue.setHours(0, 0, 0, 0)
6991
+ && +eleDateValue.setHours(0, 0, 0, 0) <= +eleEndDateValue.setHours(0, 0, 0, 0) &&
6995
6992
  !this.isSameStartEnd(new Date(+this.startValue), new Date(+this.endValue)) &&
6996
6993
  +new Date(+this.startValue).setHours(0, 0, 0, 0) >= +this.min
6997
6994
  && +new Date(+this.endValue).setHours(0, 0, 0, 0) <= +this.max
@@ -7011,7 +7008,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
7011
7008
  removeClass([ele], [RANGEHOVER]);
7012
7009
  }
7013
7010
  if (!ele.classList.contains(OTHERMONTH$2)) {
7014
- var startDateValue = new Date(+this.startValue);
7011
+ var startDateValue = this.currentView() === 'Month' ? new Date(+this.startValue) : this.getStartEndDate(new Date(+this.startValue), false);
7015
7012
  var eleDateValue_1 = new Date(+eleDate);
7016
7013
  if (this.currentView() === this.depth &&
7017
7014
  +eleDateValue_1.setHours(0, 0, 0, 0) === +startDateValue.setHours(0, 0, 0, 0)
@@ -7022,7 +7019,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
7022
7019
  addClass([ele], [STARTDATE, SELECTED$3]);
7023
7020
  this.addSelectedAttributes(ele, this.startValue, true);
7024
7021
  }
7025
- var endDateValue = new Date(+this.endValue);
7022
+ var endDateValue = this.currentView() === 'Month' ? new Date(+this.endValue) : this.getStartEndDate(new Date(+this.endValue), true);
7026
7023
  if (this.currentView() === 'Year') {
7027
7024
  eleDateValue_1 = new Date(eleDateValue_1.getFullYear(), eleDateValue_1.getMonth() + 1, 0);
7028
7025
  }
@@ -7115,14 +7112,36 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
7115
7112
  if (event) {
7116
7113
  event.preventDefault();
7117
7114
  }
7115
+ var isValue;
7116
+ var startDateValue;
7117
+ var endDateValue;
7118
+ var value = this.inputElement.value;
7119
+ if (!isNullOrUndefined(value) && value.trim() !== '') {
7120
+ var range = value.split(' ' + this.separator + ' ');
7121
+ if (range.length > 1 && ((this.currentView() === 'Year' && this.depth === 'Year')
7122
+ || (this.currentView() === 'Decade' && this.depth === 'Decade'))) {
7123
+ var dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
7124
+ startDateValue = this.globalize.parseDate(this.getAmPmValue(range[0]).trim(), dateOptions);
7125
+ endDateValue = this.globalize.parseDate(this.getAmPmValue(range[1]).trim(), dateOptions);
7126
+ isValue = true;
7127
+ }
7128
+ }
7118
7129
  var date = isNullOrUndefined(event) ? this.getIdValue(null, element)
7119
7130
  : this.getIdValue(event, null);
7131
+ if (!isNullOrUndefined(this.startValue)) {
7132
+ if (this.currentView() === 'Year' && this.depth === 'Year') {
7133
+ date = new Date(date.getFullYear(), date.getMonth(), this.startValue.getDate());
7134
+ }
7135
+ else if (this.currentView() === 'Decade' && this.depth === 'Decade') {
7136
+ date = new Date(date.getFullYear(), this.startValue.getMonth(), this.startValue.getDate());
7137
+ }
7138
+ }
7120
7139
  var y = date.getFullYear();
7121
7140
  var m = date.getMonth();
7122
- var firstDay = new Date(y, m, 1);
7123
- var lastDay = new Date(y, m + 1, 0);
7124
- var firstMonth = new Date(y, 0, 1);
7125
- var lastMonth = new Date(y, 11, 31);
7141
+ var firstDay = isValue ? new Date(y, m, startDateValue.getDate(), startDateValue.getHours(), startDateValue.getMinutes(), startDateValue.getSeconds()) : new Date(y, m, 1);
7142
+ var lastDay = isValue ? new Date(y, m, endDateValue.getDate(), endDateValue.getHours(), endDateValue.getMinutes(), endDateValue.getSeconds()) : new Date(y, m + 1, 0);
7143
+ var firstMonth = isValue ? new Date(y, startDateValue.getMonth(), startDateValue.getDate(), startDateValue.getHours(), startDateValue.getMinutes(), startDateValue.getSeconds()) : new Date(y, 0, 1);
7144
+ var lastMonth = isValue ? new Date(y, endDateValue.getMonth(), endDateValue.getDate(), endDateValue.getHours(), endDateValue.getMinutes(), endDateValue.getSeconds()) : new Date(y, 11, 31);
7126
7145
  if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue)) {
7127
7146
  if (!this.isMobile || this.isMobile && !this.endButton.element.classList.contains(ACTIVE$1)) {
7128
7147
  this.removeSelection();
@@ -14777,7 +14796,8 @@ var MaskedDateTime = /** @__PURE__ @class */ (function () {
14777
14796
  return;
14778
14797
  }
14779
14798
  this.isDayPart = true;
14780
- this.dayTypeCount = this.dayTypeCount + 1;
14799
+ var maxDaysInMonth = new Date(newDateValue.getFullYear(), newDateValue.getMonth() + 1, 0).getDate();
14800
+ this.dayTypeCount += (this.dayTypeCount === 0 && (parseInt(date + '0', 10) > maxDaysInMonth)) ? 2 : 1;
14781
14801
  }
14782
14802
  else {
14783
14803
  this.isDayPart = false;
@@ -14900,7 +14920,7 @@ var MaskedDateTime = /** @__PURE__ @class */ (function () {
14900
14920
  newDateValue.setHours(Math.floor(newDateValue.getHours() / 12) * 12 + (this.hour % 12));
14901
14921
  this.isNavigate = this.hour.toString().length === 2;
14902
14922
  this.isHourPart = true;
14903
- this.hourTypeCount = this.hourTypeCount + 1;
14923
+ this.hourTypeCount = (this.hourTypeCount === 0 && this.hour && (parseInt(this.hour + '0', 10) > 12)) ? 2 : this.hourTypeCount + 1;
14904
14924
  break;
14905
14925
  case 'H':
14906
14926
  this.hour = (this.isHourPart && newDateValue.getHours().toString().length < 2 &&
@@ -14916,7 +14936,7 @@ var MaskedDateTime = /** @__PURE__ @class */ (function () {
14916
14936
  newDateValue.setHours(this.hour);
14917
14937
  this.isNavigate = this.hour.toString().length === 2;
14918
14938
  this.isHourPart = true;
14919
- this.hourTypeCount = this.hourTypeCount + 1;
14939
+ this.hourTypeCount = (this.hourTypeCount === 0 && this.hour && (parseInt(this.hour + '0', 10) > 23)) ? 2 : this.hourTypeCount + 1;
14920
14940
  break;
14921
14941
  case 'm':
14922
14942
  {
@@ -14933,7 +14953,7 @@ var MaskedDateTime = /** @__PURE__ @class */ (function () {
14933
14953
  newDateValue.setMinutes(minutes);
14934
14954
  this.isNavigate = minutes.toString().length === 2;
14935
14955
  this.isMinutePart = true;
14936
- this.minuteTypeCount = this.minuteTypeCount + 1;
14956
+ this.minuteTypeCount = (this.minuteTypeCount === 0 && (parseInt(minutes + '0', 10) > 59)) ? 2 : this.minuteTypeCount + 1;
14937
14957
  break;
14938
14958
  }
14939
14959
  case 's':
@@ -14951,7 +14971,7 @@ var MaskedDateTime = /** @__PURE__ @class */ (function () {
14951
14971
  newDateValue.setSeconds(seconds);
14952
14972
  this.isNavigate = seconds.toString().length === 2;
14953
14973
  this.isSecondsPart = true;
14954
- this.secondTypeCount = this.secondTypeCount + 1;
14974
+ this.secondTypeCount = (this.secondTypeCount === 0 && (parseInt(seconds + '0', 10) > 59)) ? 2 : this.secondTypeCount + 1;
14955
14975
  break;
14956
14976
  }
14957
14977
  case 'a':