@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.
@@ -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
@@ -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;