@descope/web-components-ui 1.123.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.
@@ -15994,12 +15994,26 @@ const formatEpoch = (epoch, format) => {
15994
15994
  };
15995
15995
 
15996
15996
  // polyfill for safari Date API (which doesn't accept "YYYY-MM-DD" string as value)
15997
- const newDate = (date) => {
15997
+ const newDate = (date, isUtcTime) => {
15998
15998
  if (typeof date === 'number') {
15999
15999
  return new Date(date);
16000
16000
  }
16001
16001
  if (typeof date === 'string') {
16002
- return new Date(date.replace(/-/g, '/'));
16002
+ const d = new Date(date.replace(/-/g, '/'));
16003
+ if (isUtcTime) {
16004
+ return new Date(
16005
+ Date.UTC(
16006
+ d.getFullYear(),
16007
+ d.getMonth(),
16008
+ d.getDate(),
16009
+ d.getHours(),
16010
+ d.getMinutes(),
16011
+ d.getSeconds(),
16012
+ d.getMilliseconds()
16013
+ )
16014
+ );
16015
+ }
16016
+ return new Date(d);
16003
16017
  }
16004
16018
  return new Date();
16005
16019
  };
@@ -17111,10 +17125,10 @@ class RawDateFieldClass extends BaseInputClass$2 {
17111
17125
  };
17112
17126
 
17113
17127
  updateEpoch(epochOrDate) {
17114
- if (!epochOrDate) {
17128
+ if (Number.isNaN(epochOrDate) || !epochOrDate.toString()?.length) {
17115
17129
  this.epoch = '';
17116
17130
  } else {
17117
- this.epoch = dateToEpoch(newDate(epochOrDate), this.isUtcTime);
17131
+ this.epoch = dateToEpoch(newDate(epochOrDate, this.isUtcTime), this.isUtcTime);
17118
17132
  }
17119
17133
  }
17120
17134
 
@@ -17243,7 +17257,7 @@ class RawDateFieldClass extends BaseInputClass$2 {
17243
17257
  }
17244
17258
 
17245
17259
  set value(val) {
17246
- if (val) {
17260
+ if (!Number.isNaN(val)) {
17247
17261
  this.updateEpoch(val);
17248
17262
  this.updateDateCounters(newDate(val));
17249
17263
  } else {
@@ -17739,7 +17753,10 @@ class RawDateFieldClass extends BaseInputClass$2 {
17739
17753
 
17740
17754
  // we need to wait for the text-field to init
17741
17755
  setTimeout(() => {
17742
- this.value = val;
17756
+ if (Number.isNaN(parseInt(val, 10))) {
17757
+ return;
17758
+ }
17759
+ this.value = Number(val);
17743
17760
  });
17744
17761
  }
17745
17762
 
@@ -17812,12 +17829,12 @@ class RawDateFieldClass extends BaseInputClass$2 {
17812
17829
  year: '',
17813
17830
  };
17814
17831
 
17815
- if (!this.epoch) {
17832
+ if (Number.isNaN(this.epoch)) {
17816
17833
  return ret;
17817
17834
  }
17818
17835
 
17819
17836
  try {
17820
- const date = newDate(this.epoch);
17837
+ const date = this.isUtcTime ? new Date(this.epoch) : newDate(this.epoch);
17821
17838
 
17822
17839
  if (this.isUtcTime) {
17823
17840
  ret.month = date.getUTCMonth() + 1;