@websy/websy-designs 1.2.28 → 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.
@@ -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
@@ -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;