@descope/web-components-ui 1.134.0 → 1.135.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
@@ -5673,6 +5673,31 @@ const CALENDAR_LABEL_TODAY = 'Today';
5673
5673
 
5674
5674
  const MOBILE_DEVICE_INTERACTION_TIMEOUT_MS = 150;
5675
5675
 
5676
+ // polyfill for safari Date API (which doesn't accept "YYYY-MM-DD" string as value)
5677
+ const newDate = (date, isUtcTime) => {
5678
+ if (typeof date === 'number') {
5679
+ return new Date(date);
5680
+ }
5681
+ if (typeof date === 'string') {
5682
+ const d = new Date(date.replace(/-/g, '/'));
5683
+ if (isUtcTime) {
5684
+ return new Date(
5685
+ Date.UTC(
5686
+ d.getFullYear(),
5687
+ d.getMonth(),
5688
+ d.getDate(),
5689
+ d.getHours(),
5690
+ d.getMinutes(),
5691
+ d.getSeconds(),
5692
+ d.getMilliseconds()
5693
+ )
5694
+ );
5695
+ }
5696
+ return new Date(d);
5697
+ }
5698
+ return new Date();
5699
+ };
5700
+
5676
5701
  const patterns = {
5677
5702
  MM: '(0?[1-9]|1[0-2])',
5678
5703
  DD: '(0?[1-9]|[12][0-9]|3[01])',
@@ -5744,31 +5769,6 @@ const formatEpoch = (epoch, format) => {
5744
5769
  return format.replace(/DD|MM|YYYY/g, (match) => parts[match]);
5745
5770
  };
5746
5771
 
5747
- // polyfill for safari Date API (which doesn't accept "YYYY-MM-DD" string as value)
5748
- const newDate = (date, isUtcTime) => {
5749
- if (typeof date === 'number') {
5750
- return new Date(date);
5751
- }
5752
- if (typeof date === 'string') {
5753
- const d = new Date(date.replace(/-/g, '/'));
5754
- if (isUtcTime) {
5755
- return new Date(
5756
- Date.UTC(
5757
- d.getFullYear(),
5758
- d.getMonth(),
5759
- d.getDate(),
5760
- d.getHours(),
5761
- d.getMinutes(),
5762
- d.getSeconds(),
5763
- d.getMilliseconds()
5764
- )
5765
- );
5766
- }
5767
- return new Date(d);
5768
- }
5769
- return new Date();
5770
- };
5771
-
5772
5772
  const getCurrentTime = () => newDate().getTime();
5773
5773
  const getFullYear = (epoch) => newDate(epoch).getFullYear().toString();
5774
5774
  const getMonth = (epoch) => (newDate(epoch).getMonth() + 1).toString();