@descope/web-components-ui 1.124.0 → 1.125.0

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.
package/dist/index.esm.js CHANGED
@@ -5731,12 +5731,26 @@ const formatEpoch = (epoch, format) => {
5731
5731
  };
5732
5732
 
5733
5733
  // polyfill for safari Date API (which doesn't accept "YYYY-MM-DD" string as value)
5734
- const newDate = (date) => {
5734
+ const newDate = (date, isUtcTime) => {
5735
5735
  if (typeof date === 'number') {
5736
5736
  return new Date(date);
5737
5737
  }
5738
5738
  if (typeof date === 'string') {
5739
- return new Date(date.replace(/-/g, '/'));
5739
+ const d = new Date(date.replace(/-/g, '/'));
5740
+ if (isUtcTime) {
5741
+ return new Date(
5742
+ Date.UTC(
5743
+ d.getFullYear(),
5744
+ d.getMonth(),
5745
+ d.getDate(),
5746
+ d.getHours(),
5747
+ d.getMinutes(),
5748
+ d.getSeconds(),
5749
+ d.getMilliseconds()
5750
+ )
5751
+ );
5752
+ }
5753
+ return new Date(d);
5740
5754
  }
5741
5755
  return new Date();
5742
5756
  };
@@ -7041,10 +7055,10 @@ class RawDateFieldClass extends BaseInputClass$b {
7041
7055
  };
7042
7056
 
7043
7057
  updateEpoch(epochOrDate) {
7044
- if (!epochOrDate) {
7058
+ if (Number.isNaN(epochOrDate) || !epochOrDate.toString()?.length) {
7045
7059
  this.epoch = '';
7046
7060
  } else {
7047
- this.epoch = dateToEpoch(newDate(epochOrDate), this.isUtcTime);
7061
+ this.epoch = dateToEpoch(newDate(epochOrDate, this.isUtcTime), this.isUtcTime);
7048
7062
  }
7049
7063
  }
7050
7064
 
@@ -7173,7 +7187,7 @@ class RawDateFieldClass extends BaseInputClass$b {
7173
7187
  }
7174
7188
 
7175
7189
  set value(val) {
7176
- if (val) {
7190
+ if (!Number.isNaN(val)) {
7177
7191
  this.updateEpoch(val);
7178
7192
  this.updateDateCounters(newDate(val));
7179
7193
  } else {
@@ -7669,7 +7683,10 @@ class RawDateFieldClass extends BaseInputClass$b {
7669
7683
 
7670
7684
  // we need to wait for the text-field to init
7671
7685
  setTimeout(() => {
7672
- this.value = val;
7686
+ if (Number.isNaN(parseInt(val, 10))) {
7687
+ return;
7688
+ }
7689
+ this.value = Number(val);
7673
7690
  });
7674
7691
  }
7675
7692
 
@@ -7742,7 +7759,7 @@ class RawDateFieldClass extends BaseInputClass$b {
7742
7759
  year: '',
7743
7760
  };
7744
7761
 
7745
- if (!this.epoch) {
7762
+ if (Number.isNaN(this.epoch)) {
7746
7763
  return ret;
7747
7764
  }
7748
7765