@syncfusion/ej2-calendars 27.1.48 → 27.1.50

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.
@@ -499,22 +499,19 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
499
499
  this.effect = '';
500
500
  switch (e.action) {
501
501
  case 'moveLeft':
502
- if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target) &&
503
- e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
502
+ if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target)) {
504
503
  this.keyboardNavigate(-1, view, e, this.max, this.min);
505
504
  e.preventDefault();
506
505
  }
507
506
  break;
508
507
  case 'moveRight':
509
- if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target) &&
510
- e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
508
+ if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target)) {
511
509
  this.keyboardNavigate(1, view, e, this.max, this.min);
512
510
  e.preventDefault();
513
511
  }
514
512
  break;
515
513
  case 'moveUp':
516
- if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target) &&
517
- e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
514
+ if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target)) {
518
515
  if (view === 0) {
519
516
  this.keyboardNavigate(-7, view, e, this.max, this.min); // move the current date to the previous seven days.
520
517
  }
@@ -525,8 +522,7 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
525
522
  }
526
523
  break;
527
524
  case 'moveDown':
528
- if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target) &&
529
- e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
525
+ if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target)) {
530
526
  if (view === 0) {
531
527
  this.keyboardNavigate(7, view, e, this.max, this.min);
532
528
  }
@@ -1056,7 +1052,7 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
1056
1052
  return this.createElement('td', attrs);
1057
1053
  };
1058
1054
  CalendarBase.prototype.firstDay = function (date) {
1059
- var collection = this.currentView() !== 'Decade' ? this.tableBodyElement.querySelectorAll('td' + ':not(.' + OTHERMONTH + '') :
1055
+ var collection = this.currentView() !== 'Decade' ? this.tableBodyElement.querySelectorAll('td:not(.' + OTHERMONTH + '):not(.' + WEEKNUMBER + ')') :
1060
1056
  this.tableBodyElement.querySelectorAll('td' + ':not(.' + OTHERDECADE + '');
1061
1057
  if (collection.length) {
1062
1058
  for (var i = 0; i < collection.length; i++) {
@@ -1087,7 +1083,7 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
1087
1083
  };
1088
1084
  CalendarBase.prototype.findLastDay = function (date) {
1089
1085
  var collection = this.currentView() === 'Decade' ? this.tableBodyElement.querySelectorAll('td' + ':not(.' + OTHERDECADE + '') :
1090
- this.tableBodyElement.querySelectorAll('td' + ':not(.' + OTHERMONTH + '');
1086
+ this.tableBodyElement.querySelectorAll('td:not(.' + OTHERMONTH + '):not(.' + WEEKNUMBER + ')');
1091
1087
  if (collection.length) {
1092
1088
  for (var i = collection.length - 1; i >= 0; i--) {
1093
1089
  if (!collection[i].classList.contains(DISABLED)) {
@@ -3588,9 +3584,9 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
3588
3584
  formatOptions = { format: this.formatString, type: 'dateTime', skeleton: 'yMd', calendar: 'islamic' };
3589
3585
  }
3590
3586
  }
3591
- returnDate = this.checkDateValue(this.globalize.parseDate(val, formatOptions));
3587
+ returnDate = this.checkDateValue(this.globalize.parseDate(this.getAmPmValue(val), formatOptions));
3592
3588
  if (isNullOrUndefined(returnDate) && (this.getModuleName() === 'datetimepicker')) {
3593
- returnDate = this.checkDateValue(this.globalize.parseDate(val, formatDateTime));
3589
+ returnDate = this.checkDateValue(this.globalize.parseDate(this.getAmPmValue(val), formatDateTime));
3594
3590
  }
3595
3591
  return returnDate;
3596
3592
  };
@@ -4183,9 +4179,8 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4183
4179
  this.inputElement.value = this.inputElement.value.trim();
4184
4180
  }
4185
4181
  if ((this.getModuleName() === 'datetimepicker')) {
4186
- if (this.checkDateValue(this.globalize.parseDate(this.inputElement.value, dateOptions))) {
4187
- var modifiedValue = this.inputElement.value.replace(/(am|pm|Am|aM|pM|Pm)/g, function (match) { return match.toLocaleUpperCase(); });
4188
- date = this.globalize.parseDate(modifiedValue, dateOptions);
4182
+ if (this.checkDateValue(this.globalize.parseDate(this.getAmPmValue(this.inputElement.value), dateOptions))) {
4183
+ date = this.globalize.parseDate(this.getAmPmValue(this.inputElement.value), dateOptions);
4189
4184
  }
4190
4185
  else {
4191
4186
  if (this.calendarMode === 'Gregorian') {
@@ -4194,11 +4189,11 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4194
4189
  else {
4195
4190
  formatOptions = { format: format, type: 'dateTime', skeleton: 'yMd', calendar: 'islamic' };
4196
4191
  }
4197
- date = this.globalize.parseDate(this.inputElement.value, formatOptions);
4192
+ date = this.globalize.parseDate(this.getAmPmValue(this.inputElement.value), formatOptions);
4198
4193
  }
4199
4194
  }
4200
4195
  else {
4201
- date = this.globalize.parseDate(this.inputElement.value, dateOptions);
4196
+ date = this.globalize.parseDate(this.getAmPmValue(this.inputElement.value), dateOptions);
4202
4197
  date = (!isNullOrUndefined(date) && isNaN(+date)) ? null : date;
4203
4198
  if (!isNullOrUndefined(this.formatString) && this.inputElement.value !== '' && this.strictMode) {
4204
4199
  if ((this.isPopupClicked || (!this.isPopupClicked && this.inputElement.value === this.previousElementValue))
@@ -4308,6 +4303,20 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4308
4303
  this.popupObj.element.className += ' ' + this.cssClass;
4309
4304
  this.setAriaAttributes();
4310
4305
  };
4306
+ DatePicker.prototype.getAmPmValue = function (date) {
4307
+ try {
4308
+ if (typeof date === 'string' && date.trim() !== '') {
4309
+ // Replace am/pm variants with uppercase AM/PM
4310
+ return date.replace(/(am|pm|Am|aM|pM|Pm)/g, function (match) { return match.toLocaleUpperCase(); });
4311
+ }
4312
+ // If date is null, undefined, or an empty string, return a default value or empty string
4313
+ return '';
4314
+ }
4315
+ catch (error) {
4316
+ console.error('Error occurred while processing date:', error);
4317
+ return ''; // Return a default value in case of an error
4318
+ }
4319
+ };
4311
4320
  DatePicker.prototype.CalendarSwipeHandler = function (e) {
4312
4321
  var direction = 0;
4313
4322
  if (this.iconRight) {
@@ -4990,19 +4999,19 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4990
4999
  case 'value':
4991
5000
  if (((isNullOrUndefined(this.datepickerOptions) || (this.datepickerOptions['value'] === undefined)) || dynamic)) {
4992
5001
  var value = this.inputElement.getAttribute(prop);
4993
- this.setProperties(setValue(prop, this.globalize.parseDate(value, options), {}), !dynamic);
5002
+ this.setProperties(setValue(prop, this.globalize.parseDate(this.getAmPmValue(value), options), {}), !dynamic);
4994
5003
  }
4995
5004
  break;
4996
5005
  case 'min':
4997
5006
  if ((+this.min === +new Date(1900, 0, 1)) || dynamic) {
4998
5007
  var min = this.inputElement.getAttribute(prop);
4999
- this.setProperties(setValue(prop, this.globalize.parseDate(min, options), {}), !dynamic);
5008
+ this.setProperties(setValue(prop, this.globalize.parseDate(this.getAmPmValue(min), options), {}), !dynamic);
5000
5009
  }
5001
5010
  break;
5002
5011
  case 'max':
5003
5012
  if ((+this.max === +new Date(2099, 11, 31)) || dynamic) {
5004
5013
  var max = this.inputElement.getAttribute(prop);
5005
- this.setProperties(setValue(prop, this.globalize.parseDate(max, options), {}), !dynamic);
5014
+ this.setProperties(setValue(prop, this.globalize.parseDate(this.getAmPmValue(max), options), {}), !dynamic);
5006
5015
  }
5007
5016
  break;
5008
5017
  case 'type':
@@ -5905,10 +5914,10 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
5905
5914
  if (this.firstHiddenChild && this.secondHiddenChild) {
5906
5915
  var format = { format: this.formatString, type: 'datetime', skeleton: 'yMd' };
5907
5916
  if (typeof this.startDate === 'string') {
5908
- this.startDate = this.globalize.parseDate(this.startDate, format);
5917
+ this.startDate = this.globalize.parseDate(this.getAmPmValue(this.startDate), format);
5909
5918
  }
5910
5919
  if (typeof this.endDate === 'string') {
5911
- this.endDate = this.globalize.parseDate(this.endDate, format);
5920
+ this.endDate = this.globalize.parseDate(this.getAmPmValue(this.endDate), format);
5912
5921
  }
5913
5922
  this.firstHiddenChild.value = (this.startDate && this.globalize.formatDate(this.startDate, format))
5914
5923
  || (this.inputElement.value);
@@ -6084,7 +6093,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6084
6093
  break;
6085
6094
  case 'min':
6086
6095
  if ((isNullOrUndefined(this.min) || +this.min === +new Date(1900, 0, 1)) || isDynamic) {
6087
- var dateValue = this.globalize.parseDate(this.inputElement.getAttribute(prop), format);
6096
+ var dateValue = this.globalize.parseDate(this.getAmPmValue(this.inputElement.getAttribute(prop)), format);
6088
6097
  this.setProperties(setValue(prop, dateValue, {}), !isDynamic);
6089
6098
  }
6090
6099
  break;
@@ -6093,20 +6102,20 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6093
6102
  break;
6094
6103
  case 'max':
6095
6104
  if ((isNullOrUndefined(this.max) || +this.max === +new Date(2099, 11, 31)) || isDynamic) {
6096
- var dateValue = this.globalize.parseDate(this.inputElement.getAttribute(prop), format);
6105
+ var dateValue = this.globalize.parseDate(this.getAmPmValue(this.inputElement.getAttribute(prop)), format);
6097
6106
  this.setProperties(setValue(prop, dateValue, {}), !isDynamic);
6098
6107
  }
6099
6108
  break;
6100
6109
  case 'startDate':
6101
6110
  if (isNullOrUndefined(this.startDate)) {
6102
- var dateValue = this.globalize.parseDate(this.inputElement.getAttribute(prop), format);
6111
+ var dateValue = this.globalize.parseDate(this.getAmPmValue(this.inputElement.getAttribute(prop)), format);
6103
6112
  this.startValue = dateValue;
6104
6113
  this.setValue();
6105
6114
  }
6106
6115
  break;
6107
6116
  case 'endDate':
6108
6117
  if (isNullOrUndefined(this.endDate)) {
6109
- var dateValue = this.globalize.parseDate(this.inputElement.getAttribute(prop), format);
6118
+ var dateValue = this.globalize.parseDate(this.getAmPmValue(this.inputElement.getAttribute(prop)), format);
6110
6119
  this.endValue = dateValue;
6111
6120
  this.setValue();
6112
6121
  }
@@ -6341,8 +6350,8 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6341
6350
  if (range.length > 1) {
6342
6351
  this.invalidValueString = null;
6343
6352
  var dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
6344
- var start = this.globalize.parseDate(range[0], dateOptions);
6345
- var end = this.globalize.parseDate(range[1], dateOptions);
6353
+ var start = this.globalize.parseDate(this.getAmPmValue(range[0]), dateOptions);
6354
+ var end = this.globalize.parseDate(this.getAmPmValue(range[1]), dateOptions);
6346
6355
  var startDate = this.getStartEndDate(start, false, range, dateOptions);
6347
6356
  var endDate = this.getStartEndDate(end, true, range, dateOptions);
6348
6357
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
@@ -6418,7 +6427,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6418
6427
  };
6419
6428
  DateRangePicker.prototype.getStartEndDate = function (date, isEnd, range, dateOptions) {
6420
6429
  if (this.depth === 'Month') {
6421
- return this.globalize.parseDate(range[isEnd ? 1 : 0].trim(), dateOptions);
6430
+ return this.globalize.parseDate(this.getAmPmValue(range[isEnd ? 1 : 0]).trim(), dateOptions);
6422
6431
  }
6423
6432
  else if (this.depth === 'Year' && !isNullOrUndefined(date)) {
6424
6433
  return new Date(date.getFullYear(), date.getMonth() + (isEnd ? 1 : 0), isEnd ? 0 : 1);
@@ -9629,6 +9638,20 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9629
9638
  this.updateHeader();
9630
9639
  }
9631
9640
  };
9641
+ DateRangePicker.prototype.getAmPmValue = function (date) {
9642
+ try {
9643
+ if (typeof date === 'string' && date.trim() !== '') {
9644
+ // Replace am/pm variants with uppercase AM/PM
9645
+ return date.replace(/(am|pm|Am|aM|pM|Pm)/g, function (match) { return match.toLocaleUpperCase(); });
9646
+ }
9647
+ // If date is null, undefined, or an empty string, return a default value or empty string
9648
+ return '';
9649
+ }
9650
+ catch (error) {
9651
+ console.error('Error occurred while processing date:', error);
9652
+ return ''; // Return a default value in case of an error
9653
+ }
9654
+ };
9632
9655
  DateRangePicker.prototype.getStartEndValue = function (date, isEnd) {
9633
9656
  if (this.depth === 'Month') {
9634
9657
  return this.checkDateValue(new Date(this.checkValue(date)));
@@ -9729,7 +9752,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9729
9752
  break;
9730
9753
  case 'startDate':
9731
9754
  if (typeof newProp.startDate === 'string') {
9732
- newProp.startDate = this.globalize.parseDate(newProp.startDate, format);
9755
+ newProp.startDate = this.globalize.parseDate(this.getAmPmValue(newProp.startDate), format);
9733
9756
  }
9734
9757
  if (+this.initStartDate !== +newProp.startDate) {
9735
9758
  this.startValue = this.getStartEndValue(newProp.startDate, false);
@@ -9739,7 +9762,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9739
9762
  break;
9740
9763
  case 'endDate':
9741
9764
  if (typeof newProp.endDate === 'string') {
9742
- newProp.endDate = this.globalize.parseDate(newProp.endDate, format);
9765
+ newProp.endDate = this.globalize.parseDate(this.getAmPmValue(newProp.endDate), format);
9743
9766
  }
9744
9767
  if (+this.initEndDate !== +newProp.endDate) {
9745
9768
  this.endValue = this.getStartEndValue(newProp.endDate, true);
@@ -10400,18 +10423,18 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
10400
10423
  if (!(/^[a-zA-Z0-9- ]*$/).test(value)) {
10401
10424
  valueExpression = this.setCurrentDate(this.getDateObject(value));
10402
10425
  if (isNullOrUndefined(valueExpression)) {
10403
- valueExpression = this.checkDateValue(this.globalize.parseDate(valueString, {
10426
+ valueExpression = this.checkDateValue(this.globalize.parseDate(this.getAmPmValue(valueString), {
10404
10427
  format: this.getCldrDateTimeFormat(), type: 'datetime'
10405
10428
  }));
10406
10429
  if (isNullOrUndefined(valueExpression)) {
10407
- valueExpression = this.checkDateValue(this.globalize.parseDate(valueString, {
10430
+ valueExpression = this.checkDateValue(this.globalize.parseDate(this.getAmPmValue(valueString), {
10408
10431
  format: this.formatString, type: 'dateTime', skeleton: 'yMd'
10409
10432
  }));
10410
10433
  }
10411
10434
  }
10412
10435
  }
10413
10436
  }
10414
- valueExp = this.globalize.parseDate(valueString, {
10437
+ valueExp = this.globalize.parseDate(this.getAmPmValue(valueString), {
10415
10438
  format: this.getCldrDateTimeFormat(), type: 'datetime'
10416
10439
  });
10417
10440
  valueExpression = (!isNullOrUndefined(valueExp) && valueExp instanceof Date && !isNaN(+valueExp)) ? valueExp : null;
@@ -10450,6 +10473,20 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
10450
10473
  }
10451
10474
  return modules;
10452
10475
  };
10476
+ TimePicker.prototype.getAmPmValue = function (date) {
10477
+ try {
10478
+ if (typeof date === 'string' && date.trim() !== '') {
10479
+ // Replace am/pm variants with uppercase AM/PM
10480
+ return date.replace(/(am|pm|Am|aM|pM|Pm)/g, function (match) { return match.toLocaleUpperCase(); });
10481
+ }
10482
+ // If date is null, undefined, or an empty string, return a default value or empty string
10483
+ return '';
10484
+ }
10485
+ catch (error) {
10486
+ console.error('Error occurred while processing date:', error);
10487
+ return ''; // Return a default value in case of an error
10488
+ }
10489
+ };
10453
10490
  TimePicker.prototype.cldrFormat = function (type) {
10454
10491
  var cldrDateTimeString;
10455
10492
  if (this.locale === 'en' || this.locale === 'en-US') {
@@ -11955,10 +11992,10 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
11955
11992
  };
11956
11993
  TimePicker.prototype.timeParse = function (today, val) {
11957
11994
  var value;
11958
- value = this.globalize.parseDate(today + ' ' + val, {
11995
+ value = this.globalize.parseDate(this.getAmPmValue(today + ' ' + val), {
11959
11996
  format: this.cldrDateFormat() + ' ' + this.cldrTimeFormat(), type: 'datetime'
11960
11997
  });
11961
- value = isNullOrUndefined(value) ? this.globalize.parseDate(today + ' ' + val, {
11998
+ value = isNullOrUndefined(value) ? this.globalize.parseDate(this.getAmPmValue(today + ' ' + val), {
11962
11999
  format: this.cldrDateFormat() + ' ' + this.dateToNumeric(), type: 'datetime'
11963
12000
  }) : value;
11964
12001
  value = isNullOrUndefined(value) ? value : new Date(value.setMilliseconds(0));
@@ -13161,12 +13198,12 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
13161
13198
  if (this.dateFormatString === '') {
13162
13199
  this.dateFormatString = this.cldrDateTimeFormat();
13163
13200
  }
13164
- dateObject = this.globalize.parseDate(this.inputElement.value, {
13201
+ dateObject = this.globalize.parseDate(this.getAmPmValue(this.inputElement.value), {
13165
13202
  format: this.dateFormatString, type: 'datetime'
13166
13203
  });
13167
13204
  }
13168
13205
  else {
13169
- dateObject = this.globalize.parseDate(this.inputElement.value, {
13206
+ dateObject = this.globalize.parseDate(this.getAmPmValue(this.inputElement.value), {
13170
13207
  format: this.cldrDateTimeFormat(), type: 'datetime', calendar: 'islamic'
13171
13208
  });
13172
13209
  }