@ngx-mce/datetime-picker 22.1.1-next.2 → 22.1.1

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.
@@ -2994,9 +2994,19 @@ class NgxMatStartDate extends NgxMatDateRangeInputPartBase {
2994
2994
  return false;
2995
2995
  }
2996
2996
  else {
2997
- const fnCompare = (this._dateAdapter)
2998
- ? ch => !!this._dateAdapter.compareDate(ch.oldValue.start, ch.selection.start)
2999
- : _ => false;
2997
+ let fnCompare;
2998
+ if (this._dateAdapter) {
2999
+ fnCompare = ch => {
3000
+ if (!ch.oldValue || !ch.oldValue.start)
3001
+ return false;
3002
+ if (!ch.selection || !ch.selection.start)
3003
+ return false;
3004
+ return !!this._dateAdapter.compareDate(ch.oldValue.start, ch.selection.start);
3005
+ };
3006
+ }
3007
+ else {
3008
+ fnCompare = _ => false;
3009
+ }
3000
3010
  return !change.oldValue?.start
3001
3011
  ? !!change.selection.start
3002
3012
  : !change.selection.start || fnCompare(change);
@@ -3084,9 +3094,19 @@ class NgxMatEndDate extends NgxMatDateRangeInputPartBase {
3084
3094
  return false;
3085
3095
  }
3086
3096
  else {
3087
- const fnCompare = (this._dateAdapter)
3088
- ? ch => !!this._dateAdapter.compareDate(ch.oldValue.end, ch.selection.end)
3089
- : _ => false;
3097
+ let fnCompare;
3098
+ if (this._dateAdapter) {
3099
+ fnCompare = ch => {
3100
+ if (!ch.oldValue || !ch.oldValue.end)
3101
+ return false;
3102
+ if (!ch.selection || !ch.selection.end)
3103
+ return false;
3104
+ return !!this._dateAdapter.compareDate(ch.oldValue.end, ch.selection.end);
3105
+ };
3106
+ }
3107
+ else {
3108
+ fnCompare = _ => false;
3109
+ }
3090
3110
  return !change.oldValue?.end
3091
3111
  ? !!change.selection.end
3092
3112
  : !change.selection.end || fnCompare(change);
@@ -3579,7 +3599,7 @@ class NgxMatTimepickerComponent {
3579
3599
  nonNullable: true,
3580
3600
  }),
3581
3601
  });
3582
- _onChange = () => {
3602
+ _onChange = (_) => {
3583
3603
  // Intentionally left empty.
3584
3604
  };
3585
3605
  _onTouched = () => {
@@ -3691,8 +3711,8 @@ class NgxMatTimepickerComponent {
3691
3711
  }
3692
3712
  }
3693
3713
  const val = this.value();
3694
- if (val) {
3695
- let clonedModel = this._dateAdapter?.clone(val);
3714
+ if (val && this._dateAdapter) {
3715
+ let clonedModel = this._dateAdapter.clone(val);
3696
3716
  clonedModel = this._dateAdapter?.setTime(clonedModel, _hour, this.minute, this.second);
3697
3717
  this.value.set(clonedModel);
3698
3718
  this._onChange(clonedModel);
@@ -5259,7 +5279,7 @@ class NgxMatDatetimePickerInputV2 {
5259
5279
  return this._min();
5260
5280
  }
5261
5281
  set min(value) {
5262
- const validValue = this._dateAdapter?.getValidDateOrNull(this._dateAdapter.deserialize(value));
5282
+ const validValue = this._dateAdapter?.getValidDateOrNull(this._dateAdapter.deserialize(value)) ?? null;
5263
5283
  this._min.set(validValue);
5264
5284
  this._validatorOnChange();
5265
5285
  }
@@ -5270,7 +5290,7 @@ class NgxMatDatetimePickerInputV2 {
5270
5290
  return this._max();
5271
5291
  }
5272
5292
  set max(value) {
5273
- const validValue = this._dateAdapter?.getValidDateOrNull(this._dateAdapter.deserialize(value));
5293
+ const validValue = this._dateAdapter?.getValidDateOrNull(this._dateAdapter.deserialize(value)) ?? null;
5274
5294
  this._max.set(validValue);
5275
5295
  this._validatorOnChange();
5276
5296
  }
@@ -5453,9 +5473,9 @@ class NgxMatDatetimePickerInputV2 {
5453
5473
  }
5454
5474
  _onInput(event) {
5455
5475
  const target = event?.target;
5456
- const parsedDate = this._dateAdapter?.parse(target.value, this._dateFormats.display.dateInput);
5476
+ const parsedDate = this._dateAdapter?.parse(target.value, this._dateFormats.display.dateInput) ?? null;
5457
5477
  this._lastValueValid = this._dateAdapter ? this._dateAdapter.isValid(parsedDate) : false;
5458
- const date = this._dateAdapter?.getValidDateOrNull(parsedDate);
5478
+ const date = this._dateAdapter?.getValidDateOrNull(parsedDate) ?? null;
5459
5479
  // Update internal value
5460
5480
  this._value.set(date);
5461
5481
  // Notify form control