@syncfusion/ej2-calendars 24.2.5 → 24.2.9

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.
@@ -19,7 +19,7 @@ const DEVICE = 'e-device';
19
19
  const HEADER = 'e-header';
20
20
  const RTL = 'e-rtl';
21
21
  const CONTENT = 'e-content';
22
- const CONTENTTABLE = 'e-content-table';
22
+ const CONTENTTABLE = 'e-calandar-content-table';
23
23
  const YEAR = 'e-year';
24
24
  const MONTH = 'e-month';
25
25
  const DECADE = 'e-decade';
@@ -481,19 +481,19 @@ let CalendarBase = class CalendarBase extends Component {
481
481
  this.effect = '';
482
482
  switch (e.action) {
483
483
  case 'moveLeft':
484
- if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains('e-content-table')) {
484
+ if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
485
485
  this.keyboardNavigate(-1, view, e, this.max, this.min);
486
486
  e.preventDefault();
487
487
  }
488
488
  break;
489
489
  case 'moveRight':
490
- if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains('e-content-table')) {
490
+ if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
491
491
  this.keyboardNavigate(1, view, e, this.max, this.min);
492
492
  e.preventDefault();
493
493
  }
494
494
  break;
495
495
  case 'moveUp':
496
- if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains('e-content-table')) {
496
+ if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
497
497
  if (view === 0) {
498
498
  this.keyboardNavigate(-7, view, e, this.max, this.min); // move the current date to the previous seven days.
499
499
  }
@@ -504,7 +504,7 @@ let CalendarBase = class CalendarBase extends Component {
504
504
  }
505
505
  break;
506
506
  case 'moveDown':
507
- if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains('e-content-table')) {
507
+ if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
508
508
  if (view === 0) {
509
509
  this.keyboardNavigate(7, view, e, this.max, this.min);
510
510
  }
@@ -4121,7 +4121,8 @@ let DatePicker = class DatePicker extends Calendar {
4121
4121
  }
4122
4122
  if ((this.getModuleName() === 'datetimepicker')) {
4123
4123
  if (this.checkDateValue(this.globalize.parseDate(this.inputElement.value, dateOptions))) {
4124
- date = this.globalize.parseDate(this.inputElement.value.toLocaleUpperCase(), dateOptions);
4124
+ const modifiedValue = this.inputElement.value.replace(/(am|pm|Am|aM|pM|Pm)/g, (match) => match.toLocaleUpperCase());
4125
+ date = this.globalize.parseDate(modifiedValue, dateOptions);
4125
4126
  }
4126
4127
  else {
4127
4128
  if (this.calendarMode === 'Gregorian') {
@@ -5407,7 +5408,6 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5407
5408
  this.invalidValueString = null;
5408
5409
  this.isAngular = false;
5409
5410
  this.preventChange = false;
5410
- this.isKeyPressed = false;
5411
5411
  this.dateRangeOptions = options;
5412
5412
  }
5413
5413
  /**
@@ -5758,7 +5758,6 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5758
5758
  EventHandler.add(this.inputElement, 'focus', this.inputFocusHandler, this);
5759
5759
  EventHandler.add(this.inputElement, 'blur', this.inputBlurHandler, this);
5760
5760
  EventHandler.add(this.inputElement, 'change', this.inputChangeHandler, this);
5761
- EventHandler.add(this.inputElement, 'keyup', this.keyupHandler, this);
5762
5761
  if (this.showClearButton && this.inputWrapper.clearButton) {
5763
5762
  EventHandler.add(this.inputWrapper.clearButton, 'mousedown', this.resetHandler, this);
5764
5763
  }
@@ -5785,7 +5784,6 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5785
5784
  EventHandler.remove(this.inputElement, 'blur', this.inputBlurHandler);
5786
5785
  EventHandler.remove(this.inputElement, 'focus', this.inputFocusHandler);
5787
5786
  EventHandler.remove(this.inputElement, 'change', this.inputChangeHandler);
5788
- EventHandler.remove(this.inputElement, 'keyup', this.keyupHandler);
5789
5787
  if (this.showClearButton && this.inputWrapper.clearButton) {
5790
5788
  EventHandler.remove(this.inputWrapper.clearButton, 'mousedown touchstart', this.resetHandler);
5791
5789
  }
@@ -6039,8 +6037,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6039
6037
  const startDate = this.presetsItem[i].start;
6040
6038
  const endDate = this.presetsItem[i].end;
6041
6039
  if (this.startValue && this.endValue) {
6042
- if ((+new Date(startDate.setHours(0, 0, 0, 0)) === +new Date(this.startValue.setHours(0, 0, 0, 0))) &&
6043
- (+new Date(endDate.setHours(0, 0, 0, 0)) === +new Date(this.endValue.setHours(0, 0, 0, 0)))) {
6040
+ if (startDate.getDate() == this.startValue.getDate() && startDate.getMonth() == this.startValue.getMonth() && startDate.getFullYear() == this.startValue.getFullYear()
6041
+ && endDate.getDate() == this.endValue.getDate() && endDate.getMonth() == this.endValue.getMonth() && endDate.getFullYear() == this.endValue.getFullYear()) {
6044
6042
  this.activeIndex = i;
6045
6043
  this.isCustomRange = false;
6046
6044
  }
@@ -8004,9 +8002,6 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8004
8002
  this.startButton.element.classList.add(ACTIVE$1);
8005
8003
  }
8006
8004
  }
8007
- keyupHandler(e) {
8008
- this.isKeyPressed = (this.inputElement.value !== this.previousEleValue) ? true : false;
8009
- }
8010
8005
  applyFunction(eve) {
8011
8006
  let isValueChanged = false;
8012
8007
  if (eve.type !== 'touchstart') {
@@ -8029,13 +8024,15 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8029
8024
  eve.preventDefault();
8030
8025
  }
8031
8026
  if (!isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.endValue)) {
8027
+ if (!(this.previousStartValue && this.previousEndValue && this.startValue.getDate() == this.previousStartValue.getDate() && this.startValue.getMonth() == this.previousStartValue.getMonth() &&
8028
+ this.startValue.getFullYear() == this.previousStartValue.getFullYear()
8029
+ && this.endValue.getDate() == this.previousEndValue.getDate() && this.endValue.getMonth() == this.previousEndValue.getMonth()
8030
+ && this.endValue.getFullYear() == this.previousEndValue.getFullYear())) {
8031
+ Input.setValue(this.rangeArgs(eve).text, this.inputElement, this.floatLabelType, this.showClearButton);
8032
+ }
8032
8033
  this.previousStartValue = new Date(+this.startValue);
8033
8034
  this.previousEndValue = new Date(+this.endValue);
8034
8035
  this.previousEleValue = this.inputElement.value;
8035
- if (!this.isKeyPressed) {
8036
- Input.setValue(this.rangeArgs(eve).text, this.inputElement, this.floatLabelType, this.showClearButton);
8037
- }
8038
- this.isKeyPressed = false;
8039
8036
  if (+this.initStartDate !== +this.startValue || +this.initEndDate !== +this.endValue) {
8040
8037
  isValueChanged = true;
8041
8038
  }
@@ -11908,10 +11905,6 @@ let TimePicker = class TimePicker extends Component {
11908
11905
  }
11909
11906
  }
11910
11907
  removeClass([this.inputWrapper.container], [FOCUS]);
11911
- const blurArguments = {
11912
- model: this
11913
- };
11914
- this.trigger('blur', blurArguments);
11915
11908
  if (this.getText() !== this.inputElement.value) {
11916
11909
  this.updateValue((this.inputElement).value, e);
11917
11910
  }
@@ -11923,6 +11916,10 @@ let TimePicker = class TimePicker extends Component {
11923
11916
  if (this.inputElement.value === '') {
11924
11917
  this.invalidValueString = null;
11925
11918
  }
11919
+ const blurArguments = {
11920
+ model: this
11921
+ };
11922
+ this.trigger('blur', blurArguments);
11926
11923
  }
11927
11924
  /**
11928
11925
  * Focuses out the TimePicker textbox element.
@@ -14455,6 +14452,7 @@ class MaskedDateTime {
14455
14452
  {
14456
14453
  let year = (this.isYearPart && (newDateValue.getFullYear().toString().length < 4
14457
14454
  && !this.isShortYear) ? newDateValue.getFullYear() * 10 : 0) + parseInt(newVal[start - 1], 10);
14455
+ let yearValue = (this.dateformat.match(/y/g) || []).length;
14458
14456
  this.isShortYear = false;
14459
14457
  this.isYearZero = (newVal[start - 1] === '0');
14460
14458
  if (isNaN(year)) {
@@ -14468,7 +14466,7 @@ class MaskedDateTime {
14468
14466
  }
14469
14467
  else {
14470
14468
  newDateValue.setFullYear(year);
14471
- if (year.toString().length === 4) {
14469
+ if (year.toString().length === yearValue) {
14472
14470
  this.isNavigate = true;
14473
14471
  }
14474
14472
  this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
@@ -14643,9 +14641,6 @@ class MaskedDateTime {
14643
14641
  case 'yy':
14644
14642
  result = proxy.isYearPart ? proxy.roundOff(proxy.maskDateValue.getFullYear() % 100, 2) : proxy.defaultConstant['year'].toString();
14645
14643
  result = proxy.zeroCheck(proxy.isYearZero, proxy.isYearPart, result);
14646
- if (proxy.isYearPart) {
14647
- proxy.isNavigate = proxy.isShortYear = (proxy.maskDateValue.getFullYear() % 100).toString().length === 2;
14648
- }
14649
14644
  break;
14650
14645
  case 'y':
14651
14646
  case 'yyyy':