@websy/websy-designs 1.2.13 → 1.2.15
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.
|
@@ -392,10 +392,11 @@ class WebsyDatePicker {
|
|
|
392
392
|
this.validDates = []
|
|
393
393
|
this.validYears = []
|
|
394
394
|
this.validHours = []
|
|
395
|
-
this.customRangeSelected = true
|
|
395
|
+
this.customRangeSelected = true
|
|
396
396
|
this.shiftPressed = false
|
|
397
397
|
const DEFAULTS = {
|
|
398
398
|
defaultRange: 0,
|
|
399
|
+
dateFormat: '%_m/%_d/%Y',
|
|
399
400
|
allowClear: true,
|
|
400
401
|
hideRanges: false,
|
|
401
402
|
minAllowedDate: this.floorDate(new Date(new Date((new Date().setFullYear(new Date().getFullYear() - 1))).setDate(1))),
|
|
@@ -566,9 +567,7 @@ class WebsyDatePicker {
|
|
|
566
567
|
maskEl.classList.remove('active')
|
|
567
568
|
contentEl.classList.remove('active')
|
|
568
569
|
if (confirm === true) {
|
|
569
|
-
if (this.options.onChange) {
|
|
570
|
-
console.log('confirm', this.selectedRangeDates)
|
|
571
|
-
console.log('confirm', this.currentselection)
|
|
570
|
+
if (this.options.onChange) {
|
|
572
571
|
if (this.customRangeSelected === true) {
|
|
573
572
|
if (this.options.mode === 'hour') {
|
|
574
573
|
let hoursOut = []
|
|
@@ -594,10 +593,10 @@ class WebsyDatePicker {
|
|
|
594
593
|
this.updateRange()
|
|
595
594
|
}
|
|
596
595
|
else {
|
|
597
|
-
this.selectedRangeDates = [...this.priorSelectedDates]
|
|
596
|
+
this.selectedRangeDates = [...(this.priorSelectedDates || [])]
|
|
598
597
|
this.selectedRange = this.priorSelectedRange
|
|
599
598
|
this.customRangeSelected = this.priorCustomRangeSelected
|
|
600
|
-
this.currentselection = [...this.priorselection]
|
|
599
|
+
this.currentselection = [...(this.priorselection || [])]
|
|
601
600
|
this.highlightRange()
|
|
602
601
|
}
|
|
603
602
|
}
|
|
@@ -719,9 +718,7 @@ class WebsyDatePicker {
|
|
|
719
718
|
}
|
|
720
719
|
else if (this.options.mode === 'monthyear') {
|
|
721
720
|
let yearDiff = (this.selectedRangeDates[this.selectedRangeDates.length - 1].getFullYear() - this.selectedRangeDates[0].getFullYear()) * 12
|
|
722
|
-
diff = Math.floor((this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth())) + yearDiff
|
|
723
|
-
console.log('year diff', yearDiff)
|
|
724
|
-
console.log('diff', diff)
|
|
721
|
+
diff = Math.floor((this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth())) + yearDiff
|
|
725
722
|
}
|
|
726
723
|
else if (this.options.mode === 'hour') {
|
|
727
724
|
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0]
|
|
@@ -758,10 +755,7 @@ class WebsyDatePicker {
|
|
|
758
755
|
else if (this.options.mode === 'year') {
|
|
759
756
|
dateEl = document.getElementById(`${this.elementId}_${d}_year`)
|
|
760
757
|
}
|
|
761
|
-
else if (this.options.mode === 'monthyear') {
|
|
762
|
-
console.log('d', d)
|
|
763
|
-
console.log(this.selectedRangeDates)
|
|
764
|
-
console.log(rangeStart, rangeEnd)
|
|
758
|
+
else if (this.options.mode === 'monthyear') {
|
|
765
759
|
dateEl = document.getElementById(`${this.elementId}_${d}_monthyear`)
|
|
766
760
|
}
|
|
767
761
|
else if (this.options.mode === 'hour') {
|
|
@@ -1090,8 +1084,7 @@ class WebsyDatePicker {
|
|
|
1090
1084
|
else {
|
|
1091
1085
|
this.currentselection.splice(0, 0, timestamp)
|
|
1092
1086
|
}
|
|
1093
|
-
this.customRangeSelected = true
|
|
1094
|
-
console.log('current selection', this.currentselection)
|
|
1087
|
+
this.customRangeSelected = true
|
|
1095
1088
|
}
|
|
1096
1089
|
else {
|
|
1097
1090
|
let index = this.currentselection.indexOf(timestamp)
|
|
@@ -1106,8 +1099,7 @@ class WebsyDatePicker {
|
|
|
1106
1099
|
}
|
|
1107
1100
|
}
|
|
1108
1101
|
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
1109
|
-
this.selectedRangeDates = [new Date(this.currentselection[0]), new Date(this.currentselection[1] || this.currentselection[0])]
|
|
1110
|
-
console.log('selected range', this.selectedRangeDates)
|
|
1102
|
+
this.selectedRangeDates = [new Date(this.currentselection[0]), new Date(this.currentselection[1] || this.currentselection[0])]
|
|
1111
1103
|
}
|
|
1112
1104
|
else if (this.options.mode === 'year') {
|
|
1113
1105
|
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]]
|
package/dist/websy-designs.js
CHANGED
|
@@ -495,6 +495,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
495
495
|
this.shiftPressed = false;
|
|
496
496
|
var DEFAULTS = {
|
|
497
497
|
defaultRange: 0,
|
|
498
|
+
dateFormat: '%_m/%_d/%Y',
|
|
498
499
|
allowClear: true,
|
|
499
500
|
hideRanges: false,
|
|
500
501
|
minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
|
|
@@ -634,9 +635,6 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
634
635
|
|
|
635
636
|
if (confirm === true) {
|
|
636
637
|
if (this.options.onChange) {
|
|
637
|
-
console.log('confirm', this.selectedRangeDates);
|
|
638
|
-
console.log('confirm', this.currentselection);
|
|
639
|
-
|
|
640
638
|
if (this.customRangeSelected === true) {
|
|
641
639
|
if (this.options.mode === 'hour') {
|
|
642
640
|
var hoursOut = [];
|
|
@@ -664,10 +662,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
664
662
|
|
|
665
663
|
this.updateRange();
|
|
666
664
|
} else {
|
|
667
|
-
this.selectedRangeDates = _toConsumableArray(this.priorSelectedDates);
|
|
665
|
+
this.selectedRangeDates = _toConsumableArray(this.priorSelectedDates || []);
|
|
668
666
|
this.selectedRange = this.priorSelectedRange;
|
|
669
667
|
this.customRangeSelected = this.priorCustomRangeSelected;
|
|
670
|
-
this.currentselection = _toConsumableArray(this.priorselection);
|
|
668
|
+
this.currentselection = _toConsumableArray(this.priorselection || []);
|
|
671
669
|
this.highlightRange();
|
|
672
670
|
}
|
|
673
671
|
}
|
|
@@ -809,8 +807,6 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
809
807
|
} else if (this.options.mode === 'monthyear') {
|
|
810
808
|
var yearDiff = (this.selectedRangeDates[this.selectedRangeDates.length - 1].getFullYear() - this.selectedRangeDates[0].getFullYear()) * 12;
|
|
811
809
|
diff = Math.floor(this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth() - this.selectedRangeDates[0].getMonth()) + yearDiff;
|
|
812
|
-
console.log('year diff', yearDiff);
|
|
813
|
-
console.log('diff', diff);
|
|
814
810
|
} else if (this.options.mode === 'hour') {
|
|
815
811
|
diff = this.selectedRangeDates[this.selectedRangeDates.length - 1] - this.selectedRangeDates[0];
|
|
816
812
|
}
|
|
@@ -846,9 +842,6 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
846
842
|
} else if (this.options.mode === 'year') {
|
|
847
843
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
|
|
848
844
|
} else if (this.options.mode === 'monthyear') {
|
|
849
|
-
console.log('d', d);
|
|
850
|
-
console.log(this.selectedRangeDates);
|
|
851
|
-
console.log(rangeStart, rangeEnd);
|
|
852
845
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
|
|
853
846
|
} else if (this.options.mode === 'hour') {
|
|
854
847
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_hour"));
|
|
@@ -1216,7 +1209,6 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1216
1209
|
}
|
|
1217
1210
|
|
|
1218
1211
|
this.customRangeSelected = true;
|
|
1219
|
-
console.log('current selection', this.currentselection);
|
|
1220
1212
|
} else {
|
|
1221
1213
|
var index = this.currentselection.indexOf(timestamp);
|
|
1222
1214
|
|
|
@@ -1235,7 +1227,6 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1235
1227
|
|
|
1236
1228
|
if (this.options.mode === 'date' || this.options.mode === 'monthyear') {
|
|
1237
1229
|
this.selectedRangeDates = [new Date(this.currentselection[0]), new Date(this.currentselection[1] || this.currentselection[0])];
|
|
1238
|
-
console.log('selected range', this.selectedRangeDates);
|
|
1239
1230
|
} else if (this.options.mode === 'year') {
|
|
1240
1231
|
this.selectedRangeDates = [this.currentselection[0], this.currentselection[1] || this.currentselection[0]];
|
|
1241
1232
|
} else if (this.options.mode === 'monthyear') {//
|