@websy/websy-designs 1.2.8 → 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.
|
@@ -514,10 +514,10 @@ class WebsyDatePicker {
|
|
|
514
514
|
if (this.selectedRange === 0) {
|
|
515
515
|
return
|
|
516
516
|
}
|
|
517
|
-
if (this.customRangeSelected === true) {
|
|
518
|
-
console.log('if date selection', this.currentselection)
|
|
519
|
-
console.log('if month selection', this.currentselection.map(d => new Date(d)))
|
|
517
|
+
if (this.customRangeSelected === true) {
|
|
520
518
|
let diff
|
|
519
|
+
let diffStart
|
|
520
|
+
let diffEnd
|
|
521
521
|
if (this.options.mode === 'date') {
|
|
522
522
|
diff = Math.floor((this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime() - this.selectedRangeDates[0].getTime()) / this.oneDay)
|
|
523
523
|
// if (this.selectedRangeDates[0].getMonth() !== this.selectedRangeDates[this.selectedRangeDates.length - 1].getMonth()) {
|
|
@@ -536,8 +536,16 @@ class WebsyDatePicker {
|
|
|
536
536
|
console.log('year diff', yearDiff)
|
|
537
537
|
console.log('diff', diff)
|
|
538
538
|
}
|
|
539
|
-
else if (this.options.mode === 'hour') {
|
|
540
|
-
|
|
539
|
+
else if (this.options.mode === 'hour') {
|
|
540
|
+
this.options.hours.forEach(h => {
|
|
541
|
+
if (h.text === this.selectedRangeDates[0]) {
|
|
542
|
+
diffStart = h.num
|
|
543
|
+
}
|
|
544
|
+
if (h.text === this.selectedRangeDates[this.selectedRangeDates.length - 1]) {
|
|
545
|
+
diffEnd = h.num
|
|
546
|
+
}
|
|
547
|
+
})
|
|
548
|
+
diff = diffEnd - diffStart
|
|
541
549
|
}
|
|
542
550
|
for (let i = 0; i < diff + 1; i++) {
|
|
543
551
|
let d
|
|
@@ -560,9 +568,11 @@ class WebsyDatePicker {
|
|
|
560
568
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime()
|
|
561
569
|
}
|
|
562
570
|
else if (this.options.mode === 'hour') {
|
|
563
|
-
d = this.
|
|
564
|
-
rangeStart =
|
|
565
|
-
rangeEnd =
|
|
571
|
+
d = this.options.hours[i]
|
|
572
|
+
rangeStart = diffStart
|
|
573
|
+
rangeEnd = diffEnd
|
|
574
|
+
// rangeStart = this.selectedRangeDates[0]
|
|
575
|
+
// rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1]
|
|
566
576
|
}
|
|
567
577
|
let dateEl
|
|
568
578
|
if (this.options.mode === 'date') {
|
|
@@ -571,10 +581,7 @@ class WebsyDatePicker {
|
|
|
571
581
|
else if (this.options.mode === 'year') {
|
|
572
582
|
dateEl = document.getElementById(`${this.elementId}_${d}_year`)
|
|
573
583
|
}
|
|
574
|
-
else if (this.options.mode === 'monthyear') {
|
|
575
|
-
console.log('d', d)
|
|
576
|
-
console.log(this.selectedRangeDates)
|
|
577
|
-
console.log(rangeStart, rangeEnd)
|
|
584
|
+
else if (this.options.mode === 'monthyear') {
|
|
578
585
|
dateEl = document.getElementById(`${this.elementId}_${d}_monthyear`)
|
|
579
586
|
}
|
|
580
587
|
else if (this.options.mode === 'hour') {
|
|
@@ -578,11 +578,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
578
578
|
}
|
|
579
579
|
|
|
580
580
|
if (this.customRangeSelected === true) {
|
|
581
|
-
console.log('if date selection', this.currentselection);
|
|
582
|
-
console.log('if month selection', this.currentselection.map(function (d) {
|
|
583
|
-
return new Date(d);
|
|
584
|
-
}));
|
|
585
581
|
var diff;
|
|
582
|
+
var diffStart;
|
|
583
|
+
var diffEnd;
|
|
586
584
|
|
|
587
585
|
if (this.options.mode === 'date') {
|
|
588
586
|
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()) {
|
|
@@ -599,7 +597,16 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
599
597
|
console.log('year diff', yearDiff);
|
|
600
598
|
console.log('diff', diff);
|
|
601
599
|
} else if (this.options.mode === 'hour') {
|
|
602
|
-
|
|
600
|
+
this.options.hours.forEach(function (h) {
|
|
601
|
+
if (h.text === _this3.selectedRangeDates[0]) {
|
|
602
|
+
diffStart = h.num;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
if (h.text === _this3.selectedRangeDates[_this3.selectedRangeDates.length - 1]) {
|
|
606
|
+
diffEnd = h.num;
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
diff = diffEnd - diffStart;
|
|
603
610
|
}
|
|
604
611
|
|
|
605
612
|
for (var _i = 0; _i < diff + 1; _i++) {
|
|
@@ -621,9 +628,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
621
628
|
rangeStart = this.selectedRangeDates[0].getTime();
|
|
622
629
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
|
|
623
630
|
} else if (this.options.mode === 'hour') {
|
|
624
|
-
d = this.
|
|
625
|
-
rangeStart =
|
|
626
|
-
rangeEnd = this.selectedRangeDates[
|
|
631
|
+
d = this.options.hours[_i];
|
|
632
|
+
rangeStart = diffStart;
|
|
633
|
+
rangeEnd = diffEnd; // rangeStart = this.selectedRangeDates[0]
|
|
634
|
+
// rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1]
|
|
627
635
|
}
|
|
628
636
|
|
|
629
637
|
var dateEl = void 0;
|
|
@@ -633,9 +641,6 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
633
641
|
} else if (this.options.mode === 'year') {
|
|
634
642
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_year"));
|
|
635
643
|
} else if (this.options.mode === 'monthyear') {
|
|
636
|
-
console.log('d', d);
|
|
637
|
-
console.log(this.selectedRangeDates);
|
|
638
|
-
console.log(rangeStart, rangeEnd);
|
|
639
644
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_monthyear"));
|
|
640
645
|
} else if (this.options.mode === 'hour') {
|
|
641
646
|
dateEl = document.getElementById("".concat(this.elementId, "_").concat(d, "_hour"));
|