@syncfusion/ej2-calendars 27.1.48 → 27.1.51

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 27.1.48
3
+ * version : 27.1.51
4
4
  * Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-calendars@*",
3
- "_id": "@syncfusion/ej2-calendars@18.32.5",
3
+ "_id": "@syncfusion/ej2-calendars@27.1.50",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-4Wah1EymU4154eL/oMegUwjMYRSgQlMjBK+yJSeGq0LApQAc/sNQlsU3ViuBZAzzQXtzQZGNI7NyX2/cIBoXJw==",
5
+ "_integrity": "sha512-g0dL8PLj2RZ7+F14PMrZfnSHCI6aRffPm4GORONccG4B3UoadWPsd94U8sLPpeHyN4V30MBCIzS5DX4ighQ1GQ==",
6
6
  "_location": "/@syncfusion/ej2-calendars",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -31,8 +31,8 @@
31
31
  "/@syncfusion/ej2-schedule",
32
32
  "/@syncfusion/ej2-vue-calendars"
33
33
  ],
34
- "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-release/@syncfusion/ej2-calendars/-/ej2-calendars-18.32.5.tgz",
35
- "_shasum": "0f89918ef767a73b5b8d1aab41c7e0fdf0e6de50",
34
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-calendars/-/ej2-calendars-27.1.50.tgz",
35
+ "_shasum": "552a96a19e63124f18a7c4e287bec5ab2cc2060a",
36
36
  "_spec": "@syncfusion/ej2-calendars@*",
37
37
  "_where": "/jenkins/workspace/elease-automation_release_27.1.1/packages/included",
38
38
  "author": {
@@ -43,12 +43,11 @@
43
43
  },
44
44
  "bundleDependencies": false,
45
45
  "dependencies": {
46
- "@syncfusion/ej2-base": "~27.1.48",
47
- "@syncfusion/ej2-buttons": "~27.1.48",
48
- "@syncfusion/ej2-inputs": "~27.1.48",
49
- "@syncfusion/ej2-lists": "~27.1.48",
50
- "@syncfusion/ej2-popups": "~27.1.48",
51
- "markdown-spellcheck": "^1.3.1"
46
+ "@syncfusion/ej2-base": "~27.1.50",
47
+ "@syncfusion/ej2-buttons": "~27.1.51",
48
+ "@syncfusion/ej2-inputs": "~27.1.50",
49
+ "@syncfusion/ej2-lists": "~27.1.50",
50
+ "@syncfusion/ej2-popups": "~27.1.50"
52
51
  },
53
52
  "deprecated": false,
54
53
  "description": "A complete package of date or time components with built-in features such as date formatting, inline editing, multiple (range) selection, range restriction, month and year selection, strict mode, and globalization.",
@@ -81,6 +80,6 @@
81
80
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
82
81
  },
83
82
  "typings": "index.d.ts",
84
- "version": "27.1.48",
83
+ "version": "27.1.51",
85
84
  "sideEffects": false
86
85
  }
@@ -501,22 +501,19 @@ var CalendarBase = /** @class */ (function (_super) {
501
501
  this.effect = '';
502
502
  switch (e.action) {
503
503
  case 'moveLeft':
504
- if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target) &&
505
- e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
504
+ if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target)) {
506
505
  this.keyboardNavigate(-1, view, e, this.max, this.min);
507
506
  e.preventDefault();
508
507
  }
509
508
  break;
510
509
  case 'moveRight':
511
- if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target) &&
512
- e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
510
+ if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target)) {
513
511
  this.keyboardNavigate(1, view, e, this.max, this.min);
514
512
  e.preventDefault();
515
513
  }
516
514
  break;
517
515
  case 'moveUp':
518
- if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target) &&
519
- e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
516
+ if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target)) {
520
517
  if (view === 0) {
521
518
  this.keyboardNavigate(-7, view, e, this.max, this.min); // move the current date to the previous seven days.
522
519
  }
@@ -527,8 +524,7 @@ var CalendarBase = /** @class */ (function (_super) {
527
524
  }
528
525
  break;
529
526
  case 'moveDown':
530
- if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target) &&
531
- e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
527
+ if (this.getModuleName() !== 'daterangepicker' && !isNullOrUndefined(e.target)) {
532
528
  if (view === 0) {
533
529
  this.keyboardNavigate(7, view, e, this.max, this.min);
534
530
  }
@@ -1058,7 +1054,7 @@ var CalendarBase = /** @class */ (function (_super) {
1058
1054
  return this.createElement('td', attrs);
1059
1055
  };
1060
1056
  CalendarBase.prototype.firstDay = function (date) {
1061
- var collection = this.currentView() !== 'Decade' ? this.tableBodyElement.querySelectorAll('td' + ':not(.' + OTHERMONTH + '') :
1057
+ var collection = this.currentView() !== 'Decade' ? this.tableBodyElement.querySelectorAll('td:not(.' + OTHERMONTH + '):not(.' + WEEKNUMBER + ')') :
1062
1058
  this.tableBodyElement.querySelectorAll('td' + ':not(.' + OTHERDECADE + '');
1063
1059
  if (collection.length) {
1064
1060
  for (var i = 0; i < collection.length; i++) {
@@ -1089,7 +1085,7 @@ var CalendarBase = /** @class */ (function (_super) {
1089
1085
  };
1090
1086
  CalendarBase.prototype.findLastDay = function (date) {
1091
1087
  var collection = this.currentView() === 'Decade' ? this.tableBodyElement.querySelectorAll('td' + ':not(.' + OTHERDECADE + '') :
1092
- this.tableBodyElement.querySelectorAll('td' + ':not(.' + OTHERMONTH + '');
1088
+ this.tableBodyElement.querySelectorAll('td:not(.' + OTHERMONTH + '):not(.' + WEEKNUMBER + ')');
1093
1089
  if (collection.length) {
1094
1090
  for (var i = collection.length - 1; i >= 0; i--) {
1095
1091
  if (!collection[i].classList.contains(DISABLED)) {
@@ -442,6 +442,7 @@ export declare class DatePicker extends Calendar implements IInput {
442
442
  protected popupUpdate(): void;
443
443
  protected strictModeUpdate(): void;
444
444
  private createCalendar;
445
+ protected getAmPmValue(date: string | null | undefined): string;
445
446
  private CalendarSwipeHandler;
446
447
  private TouchStartHandler;
447
448
  private setAriaDisabled;
@@ -331,9 +331,9 @@ var DatePicker = /** @class */ (function (_super) {
331
331
  formatOptions = { format: this.formatString, type: 'dateTime', skeleton: 'yMd', calendar: 'islamic' };
332
332
  }
333
333
  }
334
- returnDate = this.checkDateValue(this.globalize.parseDate(val, formatOptions));
334
+ returnDate = this.checkDateValue(this.globalize.parseDate(this.getAmPmValue(val), formatOptions));
335
335
  if (isNullOrUndefined(returnDate) && (this.getModuleName() === 'datetimepicker')) {
336
- returnDate = this.checkDateValue(this.globalize.parseDate(val, formatDateTime));
336
+ returnDate = this.checkDateValue(this.globalize.parseDate(this.getAmPmValue(val), formatDateTime));
337
337
  }
338
338
  return returnDate;
339
339
  };
@@ -447,9 +447,10 @@ var DatePicker = /** @class */ (function (_super) {
447
447
  case 'ArrowDown':
448
448
  case 'Home':
449
449
  case 'End':
450
+ case 'Backspace':
450
451
  case 'Delete':
451
452
  if (this.enableMask && !this.popupObj && !this.readonly) {
452
- if (e.code !== 'Delete') {
453
+ if (e.code !== 'Delete' && e.code !== 'Backspace') {
453
454
  e.preventDefault();
454
455
  }
455
456
  this.notify('keyDownHandler', {
@@ -928,9 +929,8 @@ var DatePicker = /** @class */ (function (_super) {
928
929
  this.inputElement.value = this.inputElement.value.trim();
929
930
  }
930
931
  if ((this.getModuleName() === 'datetimepicker')) {
931
- if (this.checkDateValue(this.globalize.parseDate(this.inputElement.value, dateOptions))) {
932
- var modifiedValue = this.inputElement.value.replace(/(am|pm|Am|aM|pM|Pm)/g, function (match) { return match.toLocaleUpperCase(); });
933
- date = this.globalize.parseDate(modifiedValue, dateOptions);
932
+ if (this.checkDateValue(this.globalize.parseDate(this.getAmPmValue(this.inputElement.value), dateOptions))) {
933
+ date = this.globalize.parseDate(this.getAmPmValue(this.inputElement.value), dateOptions);
934
934
  }
935
935
  else {
936
936
  if (this.calendarMode === 'Gregorian') {
@@ -939,11 +939,11 @@ var DatePicker = /** @class */ (function (_super) {
939
939
  else {
940
940
  formatOptions = { format: format, type: 'dateTime', skeleton: 'yMd', calendar: 'islamic' };
941
941
  }
942
- date = this.globalize.parseDate(this.inputElement.value, formatOptions);
942
+ date = this.globalize.parseDate(this.getAmPmValue(this.inputElement.value), formatOptions);
943
943
  }
944
944
  }
945
945
  else {
946
- date = this.globalize.parseDate(this.inputElement.value, dateOptions);
946
+ date = this.globalize.parseDate(this.getAmPmValue(this.inputElement.value), dateOptions);
947
947
  date = (!isNullOrUndefined(date) && isNaN(+date)) ? null : date;
948
948
  if (!isNullOrUndefined(this.formatString) && this.inputElement.value !== '' && this.strictMode) {
949
949
  if ((this.isPopupClicked || (!this.isPopupClicked && this.inputElement.value === this.previousElementValue))
@@ -1053,6 +1053,20 @@ var DatePicker = /** @class */ (function (_super) {
1053
1053
  this.popupObj.element.className += ' ' + this.cssClass;
1054
1054
  this.setAriaAttributes();
1055
1055
  };
1056
+ DatePicker.prototype.getAmPmValue = function (date) {
1057
+ try {
1058
+ if (typeof date === 'string' && date.trim() !== '') {
1059
+ // Replace am/pm variants with uppercase AM/PM
1060
+ return date.replace(/(am|pm|Am|aM|pM|Pm)/g, function (match) { return match.toLocaleUpperCase(); });
1061
+ }
1062
+ // If date is null, undefined, or an empty string, return a default value or empty string
1063
+ return '';
1064
+ }
1065
+ catch (error) {
1066
+ console.error('Error occurred while processing date:', error);
1067
+ return ''; // Return a default value in case of an error
1068
+ }
1069
+ };
1056
1070
  DatePicker.prototype.CalendarSwipeHandler = function (e) {
1057
1071
  var direction = 0;
1058
1072
  if (this.iconRight) {
@@ -1739,19 +1753,19 @@ var DatePicker = /** @class */ (function (_super) {
1739
1753
  case 'value':
1740
1754
  if (((isNullOrUndefined(this.datepickerOptions) || (this.datepickerOptions['value'] === undefined)) || dynamic)) {
1741
1755
  var value = this.inputElement.getAttribute(prop);
1742
- this.setProperties(setValue(prop, this.globalize.parseDate(value, options), {}), !dynamic);
1756
+ this.setProperties(setValue(prop, this.globalize.parseDate(this.getAmPmValue(value), options), {}), !dynamic);
1743
1757
  }
1744
1758
  break;
1745
1759
  case 'min':
1746
1760
  if ((+this.min === +new Date(1900, 0, 1)) || dynamic) {
1747
1761
  var min = this.inputElement.getAttribute(prop);
1748
- this.setProperties(setValue(prop, this.globalize.parseDate(min, options), {}), !dynamic);
1762
+ this.setProperties(setValue(prop, this.globalize.parseDate(this.getAmPmValue(min), options), {}), !dynamic);
1749
1763
  }
1750
1764
  break;
1751
1765
  case 'max':
1752
1766
  if ((+this.max === +new Date(2099, 11, 31)) || dynamic) {
1753
1767
  var max = this.inputElement.getAttribute(prop);
1754
- this.setProperties(setValue(prop, this.globalize.parseDate(max, options), {}), !dynamic);
1768
+ this.setProperties(setValue(prop, this.globalize.parseDate(this.getAmPmValue(max), options), {}), !dynamic);
1755
1769
  }
1756
1770
  break;
1757
1771
  case 'type':
@@ -834,6 +834,7 @@ export declare class DateRangePicker extends CalendarBase {
834
834
  private clearModelvalue;
835
835
  private createHiddenInput;
836
836
  private setMinMaxDays;
837
+ private getAmPmValue;
837
838
  private getStartEndValue;
838
839
  /**
839
840
  * Called internally if any of the property value changed.
@@ -544,10 +544,10 @@ var DateRangePicker = /** @class */ (function (_super) {
544
544
  if (this.firstHiddenChild && this.secondHiddenChild) {
545
545
  var format = { format: this.formatString, type: 'datetime', skeleton: 'yMd' };
546
546
  if (typeof this.startDate === 'string') {
547
- this.startDate = this.globalize.parseDate(this.startDate, format);
547
+ this.startDate = this.globalize.parseDate(this.getAmPmValue(this.startDate), format);
548
548
  }
549
549
  if (typeof this.endDate === 'string') {
550
- this.endDate = this.globalize.parseDate(this.endDate, format);
550
+ this.endDate = this.globalize.parseDate(this.getAmPmValue(this.endDate), format);
551
551
  }
552
552
  this.firstHiddenChild.value = (this.startDate && this.globalize.formatDate(this.startDate, format))
553
553
  || (this.inputElement.value);
@@ -723,7 +723,7 @@ var DateRangePicker = /** @class */ (function (_super) {
723
723
  break;
724
724
  case 'min':
725
725
  if ((isNullOrUndefined(this.min) || +this.min === +new Date(1900, 0, 1)) || isDynamic) {
726
- var dateValue = this.globalize.parseDate(this.inputElement.getAttribute(prop), format);
726
+ var dateValue = this.globalize.parseDate(this.getAmPmValue(this.inputElement.getAttribute(prop)), format);
727
727
  this.setProperties(setValue(prop, dateValue, {}), !isDynamic);
728
728
  }
729
729
  break;
@@ -732,20 +732,20 @@ var DateRangePicker = /** @class */ (function (_super) {
732
732
  break;
733
733
  case 'max':
734
734
  if ((isNullOrUndefined(this.max) || +this.max === +new Date(2099, 11, 31)) || isDynamic) {
735
- var dateValue = this.globalize.parseDate(this.inputElement.getAttribute(prop), format);
735
+ var dateValue = this.globalize.parseDate(this.getAmPmValue(this.inputElement.getAttribute(prop)), format);
736
736
  this.setProperties(setValue(prop, dateValue, {}), !isDynamic);
737
737
  }
738
738
  break;
739
739
  case 'startDate':
740
740
  if (isNullOrUndefined(this.startDate)) {
741
- var dateValue = this.globalize.parseDate(this.inputElement.getAttribute(prop), format);
741
+ var dateValue = this.globalize.parseDate(this.getAmPmValue(this.inputElement.getAttribute(prop)), format);
742
742
  this.startValue = dateValue;
743
743
  this.setValue();
744
744
  }
745
745
  break;
746
746
  case 'endDate':
747
747
  if (isNullOrUndefined(this.endDate)) {
748
- var dateValue = this.globalize.parseDate(this.inputElement.getAttribute(prop), format);
748
+ var dateValue = this.globalize.parseDate(this.getAmPmValue(this.inputElement.getAttribute(prop)), format);
749
749
  this.endValue = dateValue;
750
750
  this.setValue();
751
751
  }
@@ -980,8 +980,8 @@ var DateRangePicker = /** @class */ (function (_super) {
980
980
  if (range.length > 1) {
981
981
  this.invalidValueString = null;
982
982
  var dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
983
- var start = this.globalize.parseDate(range[0], dateOptions);
984
- var end = this.globalize.parseDate(range[1], dateOptions);
983
+ var start = this.globalize.parseDate(this.getAmPmValue(range[0]), dateOptions);
984
+ var end = this.globalize.parseDate(this.getAmPmValue(range[1]), dateOptions);
985
985
  var startDate = this.getStartEndDate(start, false, range, dateOptions);
986
986
  var endDate = this.getStartEndDate(end, true, range, dateOptions);
987
987
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
@@ -1057,7 +1057,7 @@ var DateRangePicker = /** @class */ (function (_super) {
1057
1057
  };
1058
1058
  DateRangePicker.prototype.getStartEndDate = function (date, isEnd, range, dateOptions) {
1059
1059
  if (this.depth === 'Month') {
1060
- return this.globalize.parseDate(range[isEnd ? 1 : 0].trim(), dateOptions);
1060
+ return this.globalize.parseDate(this.getAmPmValue(range[isEnd ? 1 : 0]).trim(), dateOptions);
1061
1061
  }
1062
1062
  else if (this.depth === 'Year' && !isNullOrUndefined(date)) {
1063
1063
  return new Date(date.getFullYear(), date.getMonth() + (isEnd ? 1 : 0), isEnd ? 0 : 1);
@@ -4272,6 +4272,20 @@ var DateRangePicker = /** @class */ (function (_super) {
4272
4272
  this.updateHeader();
4273
4273
  }
4274
4274
  };
4275
+ DateRangePicker.prototype.getAmPmValue = function (date) {
4276
+ try {
4277
+ if (typeof date === 'string' && date.trim() !== '') {
4278
+ // Replace am/pm variants with uppercase AM/PM
4279
+ return date.replace(/(am|pm|Am|aM|pM|Pm)/g, function (match) { return match.toLocaleUpperCase(); });
4280
+ }
4281
+ // If date is null, undefined, or an empty string, return a default value or empty string
4282
+ return '';
4283
+ }
4284
+ catch (error) {
4285
+ console.error('Error occurred while processing date:', error);
4286
+ return ''; // Return a default value in case of an error
4287
+ }
4288
+ };
4275
4289
  DateRangePicker.prototype.getStartEndValue = function (date, isEnd) {
4276
4290
  if (this.depth === 'Month') {
4277
4291
  return this.checkDateValue(new Date(this.checkValue(date)));
@@ -4372,7 +4386,7 @@ var DateRangePicker = /** @class */ (function (_super) {
4372
4386
  break;
4373
4387
  case 'startDate':
4374
4388
  if (typeof newProp.startDate === 'string') {
4375
- newProp.startDate = this.globalize.parseDate(newProp.startDate, format);
4389
+ newProp.startDate = this.globalize.parseDate(this.getAmPmValue(newProp.startDate), format);
4376
4390
  }
4377
4391
  if (+this.initStartDate !== +newProp.startDate) {
4378
4392
  this.startValue = this.getStartEndValue(newProp.startDate, false);
@@ -4382,7 +4396,7 @@ var DateRangePicker = /** @class */ (function (_super) {
4382
4396
  break;
4383
4397
  case 'endDate':
4384
4398
  if (typeof newProp.endDate === 'string') {
4385
- newProp.endDate = this.globalize.parseDate(newProp.endDate, format);
4399
+ newProp.endDate = this.globalize.parseDate(this.getAmPmValue(newProp.endDate), format);
4386
4400
  }
4387
4401
  if (+this.initEndDate !== +newProp.endDate) {
4388
4402
  this.endValue = this.getStartEndValue(newProp.endDate, true);
@@ -572,12 +572,12 @@ var DateTimePicker = /** @class */ (function (_super) {
572
572
  if (this.dateFormatString === '') {
573
573
  this.dateFormatString = this.cldrDateTimeFormat();
574
574
  }
575
- dateObject = this.globalize.parseDate(this.inputElement.value, {
575
+ dateObject = this.globalize.parseDate(this.getAmPmValue(this.inputElement.value), {
576
576
  format: this.dateFormatString, type: 'datetime'
577
577
  });
578
578
  }
579
579
  else {
580
- dateObject = this.globalize.parseDate(this.inputElement.value, {
580
+ dateObject = this.globalize.parseDate(this.getAmPmValue(this.inputElement.value), {
581
581
  format: this.cldrDateTimeFormat(), type: 'datetime', calendar: 'islamic'
582
582
  });
583
583
  }
@@ -171,6 +171,34 @@ var MaskedDateTime = /** @class */ (function () {
171
171
  this.parent.inputElement.setSelectionRange(start, end);
172
172
  };
173
173
  MaskedDateTime.prototype.maskKeydownHandler = function (args) {
174
+ if (args.e.key === 'Backspace') {
175
+ var start = this.parent.inputElement.selectionStart;
176
+ var formatText = '';
177
+ if (this.validCharacters.indexOf(this.hiddenMask[start]) !== -1) {
178
+ formatText = this.hiddenMask[start];
179
+ }
180
+ switch (formatText) {
181
+ case 'd':
182
+ this.dayTypeCount = Math.max(this.dayTypeCount - 1, 0);
183
+ break;
184
+ case 'M':
185
+ this.monthTypeCount = Math.max(this.monthTypeCount - 1, 0);
186
+ break;
187
+ case 'H':
188
+ case 'h':
189
+ this.hourTypeCount = Math.max(this.hourTypeCount - 1, 0);
190
+ break;
191
+ case 'm':
192
+ this.minuteTypeCount = Math.max(this.minuteTypeCount - 1, 0);
193
+ break;
194
+ case 's':
195
+ this.secondTypeCount = Math.max(this.secondTypeCount - 1, 0);
196
+ break;
197
+ default:
198
+ break;
199
+ }
200
+ return;
201
+ }
174
202
  this.dayTypeCount = this.monthTypeCount = this.hourTypeCount = this.minuteTypeCount = this.secondTypeCount = 0;
175
203
  if (args.e.key === 'Delete') {
176
204
  this.isDeleteKey = true;
@@ -514,6 +514,7 @@ export declare class TimePicker extends Component<HTMLElement> implements IInput
514
514
  private getCldrDateTimeFormat;
515
515
  private checkInvalidValue;
516
516
  requiredModules(): ModuleDeclaration[];
517
+ protected getAmPmValue(date: string | null | undefined): string;
517
518
  private cldrFormat;
518
519
  destroy(): void;
519
520
  protected ensureInputAttribute(): void;
@@ -403,18 +403,18 @@ var TimePicker = /** @class */ (function (_super) {
403
403
  if (!(/^[a-zA-Z0-9- ]*$/).test(value)) {
404
404
  valueExpression = this.setCurrentDate(this.getDateObject(value));
405
405
  if (isNullOrUndefined(valueExpression)) {
406
- valueExpression = this.checkDateValue(this.globalize.parseDate(valueString, {
406
+ valueExpression = this.checkDateValue(this.globalize.parseDate(this.getAmPmValue(valueString), {
407
407
  format: this.getCldrDateTimeFormat(), type: 'datetime'
408
408
  }));
409
409
  if (isNullOrUndefined(valueExpression)) {
410
- valueExpression = this.checkDateValue(this.globalize.parseDate(valueString, {
410
+ valueExpression = this.checkDateValue(this.globalize.parseDate(this.getAmPmValue(valueString), {
411
411
  format: this.formatString, type: 'dateTime', skeleton: 'yMd'
412
412
  }));
413
413
  }
414
414
  }
415
415
  }
416
416
  }
417
- valueExp = this.globalize.parseDate(valueString, {
417
+ valueExp = this.globalize.parseDate(this.getAmPmValue(valueString), {
418
418
  format: this.getCldrDateTimeFormat(), type: 'datetime'
419
419
  });
420
420
  valueExpression = (!isNullOrUndefined(valueExp) && valueExp instanceof Date && !isNaN(+valueExp)) ? valueExp : null;
@@ -453,6 +453,20 @@ var TimePicker = /** @class */ (function (_super) {
453
453
  }
454
454
  return modules;
455
455
  };
456
+ TimePicker.prototype.getAmPmValue = function (date) {
457
+ try {
458
+ if (typeof date === 'string' && date.trim() !== '') {
459
+ // Replace am/pm variants with uppercase AM/PM
460
+ return date.replace(/(am|pm|Am|aM|pM|Pm)/g, function (match) { return match.toLocaleUpperCase(); });
461
+ }
462
+ // If date is null, undefined, or an empty string, return a default value or empty string
463
+ return '';
464
+ }
465
+ catch (error) {
466
+ console.error('Error occurred while processing date:', error);
467
+ return ''; // Return a default value in case of an error
468
+ }
469
+ };
456
470
  TimePicker.prototype.cldrFormat = function (type) {
457
471
  var cldrDateTimeString;
458
472
  if (this.locale === 'en' || this.locale === 'en-US') {
@@ -1960,10 +1974,10 @@ var TimePicker = /** @class */ (function (_super) {
1960
1974
  };
1961
1975
  TimePicker.prototype.timeParse = function (today, val) {
1962
1976
  var value;
1963
- value = this.globalize.parseDate(today + ' ' + val, {
1977
+ value = this.globalize.parseDate(this.getAmPmValue(today + ' ' + val), {
1964
1978
  format: this.cldrDateFormat() + ' ' + this.cldrTimeFormat(), type: 'datetime'
1965
1979
  });
1966
- value = isNullOrUndefined(value) ? this.globalize.parseDate(today + ' ' + val, {
1980
+ value = isNullOrUndefined(value) ? this.globalize.parseDate(this.getAmPmValue(today + ' ' + val), {
1967
1981
  format: this.cldrDateFormat() + ' ' + this.dateToNumeric(), type: 'datetime'
1968
1982
  }) : value;
1969
1983
  value = isNullOrUndefined(value) ? value : new Date(value.setMilliseconds(0));