@websy/websy-designs 1.2.27 → 1.2.29

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.
@@ -215,7 +215,7 @@ class WebsyDatePicker {
215
215
  hideRanges: false,
216
216
  arrowIcon: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z"/></svg>`,
217
217
  clearIcon: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 512 512"><line x1="368" y1="368" x2="144" y2="144" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/><line x1="368" y1="144" x2="144" y2="368" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/></svg>`,
218
- confirmIcon: `<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 512 512"><polyline points="416 128 192 384 96 288" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/></svg>`,
218
+ confirmIcon: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 512 512"><polyline points="416 128 192 384 96 288" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/></svg>`,
219
219
  minAllowedDate: this.floorDate(new Date(new Date((new Date().setFullYear(new Date().getFullYear() - 1))).setDate(1))),
220
220
  maxAllowedDate: this.floorDate(new Date((new Date()))),
221
221
  minAllowedYear: 1970,
@@ -985,14 +985,30 @@ class WebsyDatePicker {
985
985
  // check if the custom range matches a configured range
986
986
  for (let i = 0; i < this.options.ranges[this.options.mode].length; i++) {
987
987
  if (this.options.ranges[this.options.mode][i].range.length === 1) {
988
- if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0]) {
988
+ let a = this.options.ranges[this.options.mode][i].range[0]
989
+ let b = rangeInput[0]
990
+ if (this.options.mode === 'date') {
991
+ a = a.getTime()
992
+ b = b.getTime()
993
+ }
994
+ if (a === b) {
989
995
  this.selectedRange = i
990
996
  this.customRangeSelected = false
991
997
  break
992
998
  }
993
999
  }
994
1000
  else if (this.options.ranges[this.options.mode][i].range.length === 2) {
995
- if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0] && this.options.ranges[this.options.mode][i].range[1] === rangeInput[1]) {
1001
+ let a = this.options.ranges[this.options.mode][i].range[0]
1002
+ let b = rangeInput[0]
1003
+ let c = this.options.ranges[this.options.mode][i].range[1]
1004
+ let d = rangeInput[1]
1005
+ if (this.options.mode === 'date') {
1006
+ a = a.getTime()
1007
+ b = b.getTime()
1008
+ c = c.getTime()
1009
+ d = d.getTime()
1010
+ }
1011
+ if (a === b && c === d) {
996
1012
  this.selectedRange = i
997
1013
  this.customRangeSelected = false
998
1014
  break
@@ -288,7 +288,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
288
288
  hideRanges: false,
289
289
  arrowIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z\"/></svg>",
290
290
  clearIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
291
- confirmIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><polyline points=\"416 128 192 384 96 288\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
291
+ confirmIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 512 512\"><polyline points=\"416 128 192 384 96 288\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
292
292
  minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
293
293
  maxAllowedDate: this.floorDate(new Date(new Date())),
294
294
  minAllowedYear: 1970,
@@ -1097,13 +1097,33 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1097
1097
 
1098
1098
  for (var i = 0; i < this.options.ranges[this.options.mode].length; i++) {
1099
1099
  if (this.options.ranges[this.options.mode][i].range.length === 1) {
1100
- if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0]) {
1100
+ var a = this.options.ranges[this.options.mode][i].range[0];
1101
+ var b = rangeInput[0];
1102
+
1103
+ if (this.options.mode === 'date') {
1104
+ a = a.getTime();
1105
+ b = b.getTime();
1106
+ }
1107
+
1108
+ if (a === b) {
1101
1109
  this.selectedRange = i;
1102
1110
  this.customRangeSelected = false;
1103
1111
  break;
1104
1112
  }
1105
1113
  } else if (this.options.ranges[this.options.mode][i].range.length === 2) {
1106
- if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0] && this.options.ranges[this.options.mode][i].range[1] === rangeInput[1]) {
1114
+ var _a = this.options.ranges[this.options.mode][i].range[0];
1115
+ var _b = rangeInput[0];
1116
+ var c = this.options.ranges[this.options.mode][i].range[1];
1117
+ var d = rangeInput[1];
1118
+
1119
+ if (this.options.mode === 'date') {
1120
+ _a = _a.getTime();
1121
+ _b = _b.getTime();
1122
+ c = c.getTime();
1123
+ d = d.getTime();
1124
+ }
1125
+
1126
+ if (_a === _b && c === d) {
1107
1127
  this.selectedRange = i;
1108
1128
  this.customRangeSelected = false;
1109
1129
  break;