@websy/websy-designs 1.2.8 → 1.2.10
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.
|
@@ -700,10 +700,10 @@ class WebsyDatePicker {
|
|
|
700
700
|
if (this.selectedRange === 0) {
|
|
701
701
|
return
|
|
702
702
|
}
|
|
703
|
-
if (this.customRangeSelected === true) {
|
|
704
|
-
console.log('if date selection', this.currentselection)
|
|
705
|
-
console.log('if month selection', this.currentselection.map(d => new Date(d)))
|
|
703
|
+
if (this.customRangeSelected === true) {
|
|
706
704
|
let diff
|
|
705
|
+
let diffStart
|
|
706
|
+
let diffEnd
|
|
707
707
|
if (this.options.mode === 'date') {
|
|
708
708
|
diff = Math.floor((this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime() - this.selectedRangeDates[0].getTime()) / this.oneDay)
|
|
709
709
|
// if (this.selectedRangeDates[0].getMonth() !== this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth()) {
|
|
@@ -722,8 +722,16 @@ class WebsyDatePicker {
|
|
|
722
722
|
console.log('year diff', yearDiff)
|
|
723
723
|
console.log('diff', diff)
|
|
724
724
|
}
|
|
725
|
-
else if (this.options.mode === 'hour') {
|
|
726
|
-
|
|
725
|
+
else if (this.options.mode === 'hour') {
|
|
726
|
+
this.options.hours.forEach((h, i) => {
|
|
727
|
+
if (h.text === this.selectedRangeDates[0]) {
|
|
728
|
+
diffStart = i
|
|
729
|
+
}
|
|
730
|
+
if (h.text === this.selectedRangeDates[this.selectedRangeDates.length - 1]) {
|
|
731
|
+
diffEnd = i
|
|
732
|
+
}
|
|
733
|
+
})
|
|
734
|
+
diff = diffEnd - diffStart
|
|
727
735
|
}
|
|
728
736
|
for (let i = 0; i < diff + 1; i++) {
|
|
729
737
|
let d
|
|
@@ -746,9 +754,11 @@ class WebsyDatePicker {
|
|
|
746
754
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime()
|
|
747
755
|
}
|
|
748
756
|
else if (this.options.mode === 'hour') {
|
|
749
|
-
d = this.
|
|
750
|
-
rangeStart =
|
|
751
|
-
rangeEnd =
|
|
757
|
+
d = this.options.hours[i]
|
|
758
|
+
rangeStart = diffStart
|
|
759
|
+
rangeEnd = diffEnd
|
|
760
|
+
// rangeStart = this.selectedRangeDates[0]
|
|
761
|
+
// rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1]
|
|
752
762
|
}
|
|
753
763
|
let dateEl
|
|
754
764
|
if (this.options.mode === 'date') {
|
|
@@ -757,10 +767,7 @@ class WebsyDatePicker {
|
|
|
757
767
|
else if (this.options.mode === 'year') {
|
|
758
768
|
dateEl = document.getElementById(`${this.elementId}_${d}_year`)
|
|
759
769
|
}
|
|
760
|
-
else if (this.options.mode === 'monthyear') {
|
|
761
|
-
console.log('d', d)
|
|
762
|
-
console.log(this.selectedRangeDates)
|
|
763
|
-
console.log(rangeStart, rangeEnd)
|
|
770
|
+
else if (this.options.mode === 'monthyear') {
|
|
764
771
|
dateEl = document.getElementById(`${this.elementId}_${d}_monthyear`)
|
|
765
772
|
}
|
|
766
773
|
else if (this.options.mode === 'hour') {
|
package/dist/websy-designs.js
CHANGED
|
@@ -790,11 +790,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
790
790
|
}
|
|
791
791
|
|
|
792
792
|
if (this.customRangeSelected === true) {
|
|
793
|
-
console.log('if date selection', this.currentselection);
|
|
794
|
-
console.log('if month selection', this.currentselection.map(function (d) {
|
|
795
|
-
return new Date(d);
|
|
796
|
-
}));
|
|
797
793
|
var diff;
|
|
794
|
+
var diffStart;
|
|
795
|
+
var diffEnd;
|
|
798
796
|
|
|
799
797
|
if (this.options.mode === 'date') {
|
|
800
798
|
diff = Math.floor((this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime() - this.selectedRangeDates[0].getTime()) / this.oneDay); // if (this.selectedRangeDates[0].getMonth() !== this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth()) {
|
|
@@ -811,7 +809,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
811
809
|
console.log('year diff', yearDiff);
|
|
812
810
|
console.log('diff', diff);
|
|
813
811
|
} else if (this.options.mode === 'hour') {
|
|
814
|
-
|
|
812
|
+
this.options.hours.forEach(function (h, i) {
|
|
813
|
+
if (h.text === _this5.selectedRangeDates[0]) {
|
|
814
|
+
diffStart = i;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
if (h.text === _this5.selectedRangeDates[_this5.selectedRangeDates.length - 1]) {
|
|
818
|
+
diffEnd = i;
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
diff = diffEnd - diffStart;
|
|
815
822
|
}
|
|
816
823
|
|
|
817
824
|
for (var _i = 0; _i < diff + 1; _i++) {
|
|
@@ -833,9 +840,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
833
840
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
834
841
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
835
842
|
} else if (this.options.mode === 'hour') {
|
|
836
|
-
d = this.
|
|
837
|
-
rangeStart =
|
|
838
|
-
rangeEnd = this.selectedRangeDates[
|
|
843
|
+
d = this.options.hours[_i];
|
|
844
|
+
rangeStart = diffStart;
|
|
845
|
+
rangeEnd = diffEnd; // rangeStart = this.selectedRangeDates[0]
|
|
846
|
+
// rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1]
|
|
839
847
|
}
|
|
840
848
|
|
|
841
849
|
var dateEl = void 0;
|
|
@@ -845,9 +853,6 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
845
853
|
} else if (this.options.mode === 'year') {
|
|
846
854
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
|
|
847
855
|
} else if (this.options.mode === 'monthyear') {
|
|
848
|
-
console.log('d', d);
|
|
849
|
-
console.log(this.selectedRangeDates);
|
|
850
|
-
console.log(rangeStart, rangeEnd);
|
|
851
856
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
|
|
852
857
|
} else if (this.options.mode === 'hour') {
|
|
853
858
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_hour"));
|