@websy/websy-designs 1.2.18 → 1.2.19
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/websy-designs-es6.debug.js +29 -7
- package/dist/websy-designs-es6.js +217 -194
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +29 -7
- package/dist/websy-designs.js +217 -194
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -1134,22 +1134,44 @@ class WebsyDatePicker {
|
|
|
1134
1134
|
this.close(confirm)
|
|
1135
1135
|
}
|
|
1136
1136
|
}
|
|
1137
|
-
selectCustomRange (
|
|
1137
|
+
selectCustomRange (rangeInput) {
|
|
1138
1138
|
this.selectedRange = -1
|
|
1139
|
-
|
|
1140
|
-
if (
|
|
1141
|
-
this.
|
|
1142
|
-
|
|
1139
|
+
let isContinuousRange = true
|
|
1140
|
+
if (rangeInput.length === 1) {
|
|
1141
|
+
this.selectedRangeDates = [...rangeInput]
|
|
1142
|
+
this.customRangeSelected = [...rangeInput]
|
|
1143
|
+
}
|
|
1144
|
+
else if (rangeInput.length === 2) {
|
|
1145
|
+
this.selectedRangeDates = [...rangeInput]
|
|
1146
|
+
this.customRangeSelected = [...rangeInput]
|
|
1147
|
+
}
|
|
1148
|
+
rangeInput.forEach((r, i) => {
|
|
1149
|
+
if (i > 0) {
|
|
1150
|
+
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
1151
|
+
if ((r.getTime() / this.oneDay) - (rangeInput[i - 1] / this.oneDay) > 1) {
|
|
1152
|
+
isContinuousRange = false
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
else if (this.options.mode === 'hour' || this.options.mode === 'year') {
|
|
1156
|
+
if (r - rangeInput[i - 1] > 1) {
|
|
1157
|
+
isContinuousRange = false
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
})
|
|
1162
|
+
if (rangeInput.length > 2 && isContinuousRange === true) {
|
|
1163
|
+
this.selectedRangeDates = [rangeInput[0], rangeInput[rangeInput.length - 1]]
|
|
1164
|
+
}
|
|
1143
1165
|
// check if the custom range matches a configured range
|
|
1144
1166
|
for (let i = 0; i < this.options.ranges[this.options.mode].length; i++) {
|
|
1145
1167
|
if (this.options.ranges[this.options.mode][i].range.length === 1) {
|
|
1146
|
-
if (this.options.ranges[this.options.mode][i].range[0] ===
|
|
1168
|
+
if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0]) {
|
|
1147
1169
|
this.selectedRange = i
|
|
1148
1170
|
break
|
|
1149
1171
|
}
|
|
1150
1172
|
}
|
|
1151
1173
|
else if (this.options.ranges[this.options.mode][i].range.length === 2) {
|
|
1152
|
-
if (this.options.ranges[this.options.mode][i].range[0] ===
|
|
1174
|
+
if (this.options.ranges[this.options.mode][i].range[0] === rangeInput[0] && this.options.ranges[this.options.mode][i].range[1] === rangeInput[1]) {
|
|
1153
1175
|
this.selectedRange = i
|
|
1154
1176
|
break
|
|
1155
1177
|
}
|