@vsn-ux/ngx-gaia 0.12.2 → 0.12.3

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.
@@ -1720,7 +1720,7 @@ class GaDatepickerInputDirective {
1720
1720
  this.valueInput(); // explicit call to track value input changes
1721
1721
  this.lastValueValid.set(true);
1722
1722
  untracked(() => {
1723
- this.lastDateChangeEmittedValue.set(this.dateStruct());
1723
+ this.lastDateChangeEmittedValue.set(this.value());
1724
1724
  this.formatValue();
1725
1725
  });
1726
1726
  });
@@ -1752,12 +1752,15 @@ class GaDatepickerInputDirective {
1752
1752
  }
1753
1753
  onBlur() {
1754
1754
  this.focused = false;
1755
- if (this.dateStruct()) {
1755
+ if (this.lastValueValid() && this.dateStruct()) {
1756
1756
  this.formatValue();
1757
1757
  }
1758
- if (compareStructs(this.dateStruct(), this.lastDateChangeEmittedValue()) !== 0) {
1758
+ const changed = this.preserveRawValue() && !this.lastValueValid()
1759
+ ? this.value() !== this.lastDateChangeEmittedValue()
1760
+ : compareStructs(this.dateStruct(), this.valueAdapter.toStruct(this.lastDateChangeEmittedValue())) !== 0;
1761
+ if (changed) {
1759
1762
  this.dateChange.emit(this.value());
1760
- this.lastDateChangeEmittedValue.set(this.dateStruct());
1763
+ this.lastDateChangeEmittedValue.set(this.value());
1761
1764
  }
1762
1765
  this.onNgTouchedFn?.();
1763
1766
  }
@@ -1776,7 +1779,7 @@ class GaDatepickerInputDirective {
1776
1779
  updateValue(value, { updateView, emitToNgModel, } = {}) {
1777
1780
  this.value.set(value);
1778
1781
  this.lastValueValid.set(true);
1779
- this.lastDateChangeEmittedValue.set(this.dateStruct());
1782
+ this.lastDateChangeEmittedValue.set(value);
1780
1783
  if (updateView) {
1781
1784
  this.formatValue();
1782
1785
  }
@@ -1928,8 +1931,9 @@ class GaDatepickerNativeUtcIsoValueAdapter extends GaDatepickerValueAdapter {
1928
1931
  * Converts ISO Date to internal struct representation
1929
1932
  * Uses UTC to avoid timezone issues and normalizes to midnight
1930
1933
  */
1934
+ isoDatePattern = /^\d{4}-\d{2}-\d{2}/;
1931
1935
  toStruct(value) {
1932
- if (!value)
1936
+ if (!value || !this.isoDatePattern.test(value))
1933
1937
  return null;
1934
1938
  const date = new Date(value);
1935
1939
  if (isNaN(date.getTime())) {