@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.
@@ -401,7 +401,7 @@ class WebsyDatePicker {
401
401
  hideRanges: false,
402
402
  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>`,
403
403
  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>`,
404
- 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>`,
404
+ 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>`,
405
405
  minAllowedDate: this.floorDate(new Date(new Date((new Date().setFullYear(new Date().getFullYear() - 1))).setDate(1))),
406
406
  maxAllowedDate: this.floorDate(new Date((new Date()))),
407
407
  minAllowedYear: 1970,
@@ -1171,14 +1171,30 @@ class WebsyDatePicker {
1171
1171
  // check if the custom range matches a configured range
1172
1172
  for (let i = 0; i < this.options.ranges[this.options.mode].length; i++) {
1173
1173
  if (this.options.ranges[this.options.mode][i].range.length === 1) {
1174
- if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0]) {
1174
+ let a = this.options.ranges[this.options.mode][i].range[0]
1175
+ let b = rangeInput[0]
1176
+ if (this.options.mode === 'date') {
1177
+ a = a.getTime()
1178
+ b = b.getTime()
1179
+ }
1180
+ if (a === b) {
1175
1181
  this.selectedRange = i
1176
1182
  this.customRangeSelected = false
1177
1183
  break
1178
1184
  }
1179
1185
  }
1180
1186
  else if (this.options.ranges[this.options.mode][i].range.length === 2) {
1181
- if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0] && this.options.ranges[this.options.mode][i].range[1] === rangeInput[1]) {
1187
+ let a = this.options.ranges[this.options.mode][i].range[0]
1188
+ let b = rangeInput[0]
1189
+ let c = this.options.ranges[this.options.mode][i].range[1]
1190
+ let d = rangeInput[1]
1191
+ if (this.options.mode === 'date') {
1192
+ a = a.getTime()
1193
+ b = b.getTime()
1194
+ c = c.getTime()
1195
+ d = d.getTime()
1196
+ }
1197
+ if (a === b && c === d) {
1182
1198
  this.selectedRange = i
1183
1199
  this.customRangeSelected = false
1184
1200
  break
@@ -500,7 +500,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
500
500
  hideRanges: false,
501
501
  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>",
502
502
  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>",
503
- 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>",
503
+ 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>",
504
504
  minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
505
505
  maxAllowedDate: this.floorDate(new Date(new Date())),
506
506
  minAllowedYear: 1970,
@@ -1309,13 +1309,33 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1309
1309
 
1310
1310
  for (var i = 0; i < this.options.ranges[this.options.mode].length; i++) {
1311
1311
  if (this.options.ranges[this.options.mode][i].range.length === 1) {
1312
- if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0]) {
1312
+ var a = this.options.ranges[this.options.mode][i].range[0];
1313
+ var b = rangeInput[0];
1314
+
1315
+ if (this.options.mode === 'date') {
1316
+ a = a.getTime();
1317
+ b = b.getTime();
1318
+ }
1319
+
1320
+ if (a === b) {
1313
1321
  this.selectedRange = i;
1314
1322
  this.customRangeSelected = false;
1315
1323
  break;
1316
1324
  }
1317
1325
  } else if (this.options.ranges[this.options.mode][i].range.length === 2) {
1318
- if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0] && this.options.ranges[this.options.mode][i].range[1] === rangeInput[1]) {
1326
+ var _a = this.options.ranges[this.options.mode][i].range[0];
1327
+ var _b = rangeInput[0];
1328
+ var c = this.options.ranges[this.options.mode][i].range[1];
1329
+ var d = rangeInput[1];
1330
+
1331
+ if (this.options.mode === 'date') {
1332
+ _a = _a.getTime();
1333
+ _b = _b.getTime();
1334
+ c = c.getTime();
1335
+ d = d.getTime();
1336
+ }
1337
+
1338
+ if (_a === _b && c === d) {
1319
1339
  this.selectedRange = i;
1320
1340
  this.customRangeSelected = false;
1321
1341
  break;