@websy/websy-designs 1.2.7 → 1.2.9
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 => {
|
|
727
|
+
if (h.text === this.selectedRangeDates[0]) {
|
|
728
|
+
diffStart = h.num
|
|
729
|
+
}
|
|
730
|
+
if (h.text === this.selectedRangeDates[this.selectedRangeDates.length - 1]) {
|
|
731
|
+
diffEnd = h.num
|
|
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') {
|
|
@@ -881,12 +888,13 @@ class WebsyDatePicker {
|
|
|
881
888
|
}
|
|
882
889
|
if (this.monthYearMonths.indexOf(`${d.getMonth()}-${d.getFullYear()}`) === -1) {
|
|
883
890
|
this.monthYearMonths.push(`${d.getMonth()}-${d.getFullYear()}`)
|
|
891
|
+
let firstOfMonth = new Date(new Date(d).setDate(1))
|
|
884
892
|
this.monthYears[d.getFullYear()].push({
|
|
885
|
-
date:
|
|
893
|
+
date: firstOfMonth,
|
|
886
894
|
month: this.options.monthMap[d.getMonth()],
|
|
887
895
|
monthNum: d.getMonth(),
|
|
888
896
|
year: d.getFullYear(),
|
|
889
|
-
id:
|
|
897
|
+
id: firstOfMonth.getTime()
|
|
890
898
|
})
|
|
891
899
|
}
|
|
892
900
|
if (disabled.indexOf(d.getTime()) === -1) {
|
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) {
|
|
813
|
+
if (h.text === _this5.selectedRangeDates[0]) {
|
|
814
|
+
diffStart = h.num;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
if (h.text === _this5.selectedRangeDates[_this5.selectedRangeDates.length - 1]) {
|
|
818
|
+
diffEnd = h.num;
|
|
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"));
|
|
@@ -988,12 +993,13 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
988
993
|
|
|
989
994
|
if (this.monthYearMonths.indexOf("".concat(d.getMonth(), "-").concat(d.getFullYear())) === -1) {
|
|
990
995
|
this.monthYearMonths.push("".concat(d.getMonth(), "-").concat(d.getFullYear()));
|
|
996
|
+
var firstOfMonth = new Date(new Date(d).setDate(1));
|
|
991
997
|
this.monthYears[d.getFullYear()].push({
|
|
992
|
-
date:
|
|
998
|
+
date: firstOfMonth,
|
|
993
999
|
month: this.options.monthMap[d.getMonth()],
|
|
994
1000
|
monthNum: d.getMonth(),
|
|
995
1001
|
year: d.getFullYear(),
|
|
996
|
-
id:
|
|
1002
|
+
id: firstOfMonth.getTime()
|
|
997
1003
|
});
|
|
998
1004
|
}
|
|
999
1005
|
|