@descope/web-components-ui 2.2.2 → 2.2.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.
@@ -16064,19 +16064,6 @@ const newDate = (date, isUtcTime) => {
16064
16064
  }
16065
16065
  if (typeof date === 'string') {
16066
16066
  const d = new Date(date.replace(/-/g, '/'));
16067
- if (isUtcTime) {
16068
- return new Date(
16069
- Date.UTC(
16070
- d.getFullYear(),
16071
- d.getMonth(),
16072
- d.getDate(),
16073
- d.getHours(),
16074
- d.getMinutes(),
16075
- d.getSeconds(),
16076
- d.getMilliseconds()
16077
- )
16078
- );
16079
- }
16080
16067
  return new Date(d);
16081
16068
  }
16082
16069
  return new Date();
@@ -16174,9 +16161,16 @@ const parseDateString = (val, format) => {
16174
16161
  };
16175
16162
 
16176
16163
  const dateToEpoch = (date, isUtc) => {
16164
+ // If it's already a number (epoch), return it directly - no conversion needed
16165
+ if (typeof date === 'number') {
16166
+ return date;
16167
+ }
16168
+
16177
16169
  if (isUtc) {
16178
- return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).getTime();
16170
+ return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());
16179
16171
  }
16172
+
16173
+ // Default: return epoch in local timezone
16180
16174
  return date.getTime();
16181
16175
  };
16182
16176
 
@@ -17245,7 +17239,7 @@ class RawDateFieldClass extends BaseInputClass$2 {
17245
17239
 
17246
17240
  updateValue() {
17247
17241
  if (this.isCountersOutOfRange) {
17248
- this.updateEpoch('');
17242
+ this.resetEpoch();
17249
17243
  } else {
17250
17244
  const date = formats[this.format].getDate(this.inputElement.value);
17251
17245
  this.updateEpoch(dateToEpoch(date, this.isUtcTime));
@@ -17259,12 +17253,8 @@ class RawDateFieldClass extends BaseInputClass$2 {
17259
17253
  this.#dispatchInput();
17260
17254
  };
17261
17255
 
17262
- updateEpoch(epochOrDate) {
17263
- if (Number.isNaN(epochOrDate) || !epochOrDate.toString()?.length) {
17264
- this.epoch = '';
17265
- } else {
17266
- this.epoch = dateToEpoch(newDate(epochOrDate, this.isUtcTime), this.isUtcTime);
17267
- }
17256
+ updateEpoch(epoch) {
17257
+ this.epoch = dateToEpoch(epoch, this.isUtcTime);
17268
17258
  }
17269
17259
 
17270
17260
  dateCounters = [
@@ -17395,14 +17385,18 @@ class RawDateFieldClass extends BaseInputClass$2 {
17395
17385
  let value = parseInt(val, 10);
17396
17386
  if (!Number.isNaN(value)) {
17397
17387
  this.updateEpoch(value);
17398
- this.updateDateCounters(newDate(value));
17388
+ this.updateDateCounters(new Date(value));
17399
17389
  } else {
17400
- this.updateEpoch('');
17390
+ this.resetEpoch();
17401
17391
  this.resetDateCounters();
17402
17392
  this.clearInputEle();
17403
17393
  }
17404
17394
  }
17405
17395
 
17396
+ resetEpoch() {
17397
+ this.epoch = '';
17398
+ }
17399
+
17406
17400
  get isCountersEmpty() {
17407
17401
  return this.dateCounters.every((dc) => dc.isEmpty);
17408
17402
  }
@@ -17976,7 +17970,7 @@ class RawDateFieldClass extends BaseInputClass$2 {
17976
17970
  }
17977
17971
 
17978
17972
  try {
17979
- const date = this.isUtcTime ? new Date(this.epoch) : newDate(this.epoch);
17973
+ const date = new Date(this.epoch);
17980
17974
 
17981
17975
  if (this.isUtcTime) {
17982
17976
  ret.month = date.getUTCMonth() + 1;