@wernfried/daterangepicker 5.2.4 → 5.2.6
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/README.md +8 -8
- package/dist/cjs/daterangepicker.cjs +2370 -2367
- package/dist/cjs/daterangepicker.cjs.map +1 -1
- package/dist/cjs/daterangepicker.min.cjs +1 -1
- package/dist/cjs/daterangepicker.min.cjs.map +1 -1
- package/dist/esm/daterangepicker.js +11 -8
- package/dist/esm/daterangepicker.js.map +1 -1
- package/dist/esm/daterangepicker.min.js +1 -1
- package/dist/esm/daterangepicker.min.js.map +1 -1
- package/dist/global/daterangepicker.js +11 -8
- package/dist/global/daterangepicker.js.map +1 -1
- package/dist/global/daterangepicker.min.js +1 -1
- package/dist/global/daterangepicker.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -65,8 +65,7 @@ class DateRangePicker {
|
|
|
65
65
|
};
|
|
66
66
|
if (this.element == null)
|
|
67
67
|
return;
|
|
68
|
-
this.callback =
|
|
69
|
-
};
|
|
68
|
+
this.callback = null;
|
|
70
69
|
this.isShowing = false;
|
|
71
70
|
this.leftCalendar = {};
|
|
72
71
|
this.rightCalendar = {};
|
|
@@ -356,8 +355,8 @@ class DateRangePicker {
|
|
|
356
355
|
if (!this.timePicker) {
|
|
357
356
|
if (this.minDate) this.minDate = this.minDate.startOf("day");
|
|
358
357
|
if (this.maxDate) this.maxDate = this.maxDate.endOf("day");
|
|
359
|
-
this.#startDate = this.#startDate.startOf("day");
|
|
360
|
-
this.#endDate = this.#endDate.endOf("day");
|
|
358
|
+
if (this.#startDate) this.#startDate = this.#startDate.startOf("day");
|
|
359
|
+
if (this.#endDate) this.#endDate = this.#endDate.endOf("day");
|
|
361
360
|
}
|
|
362
361
|
if (!this.#startDate && this.initalMonth) {
|
|
363
362
|
this.#endDate = null;
|
|
@@ -540,14 +539,14 @@ class DateRangePicker {
|
|
|
540
539
|
* @type {external:DateTime}
|
|
541
540
|
*/
|
|
542
541
|
get startDate() {
|
|
543
|
-
return this.timePicker ? this.#startDate : this.#startDate
|
|
542
|
+
return this.timePicker ? this.#startDate : this.#startDate?.startOf("day") ?? null;
|
|
544
543
|
}
|
|
545
544
|
/**
|
|
546
545
|
* endDate
|
|
547
546
|
* @type {external:DateTime}
|
|
548
547
|
*/
|
|
549
548
|
get endDate() {
|
|
550
|
-
return this.singleDatePicker ? null : this.timePicker ? this.#endDate : this.#endDate
|
|
549
|
+
return this.singleDatePicker ? null : (this.timePicker ? this.#endDate : this.#endDate?.endOf("day")) ?? null;
|
|
551
550
|
}
|
|
552
551
|
set startDate(val) {
|
|
553
552
|
this.#startDate = val;
|
|
@@ -879,6 +878,8 @@ class DateRangePicker {
|
|
|
879
878
|
* @returns {string} - Formatted date string
|
|
880
879
|
*/
|
|
881
880
|
formatDate(date, format = this.locale.format) {
|
|
881
|
+
if (date === null)
|
|
882
|
+
return null;
|
|
882
883
|
if (typeof format === "object") {
|
|
883
884
|
return date.toLocaleString(format);
|
|
884
885
|
} else {
|
|
@@ -1655,8 +1656,10 @@ class DateRangePicker {
|
|
|
1655
1656
|
this.#startDate = this.oldStartDate;
|
|
1656
1657
|
this.#endDate = this.oldEndDate;
|
|
1657
1658
|
}
|
|
1658
|
-
if (
|
|
1659
|
-
this.
|
|
1659
|
+
if (typeof this.callback === "function") {
|
|
1660
|
+
if (this.#startDate && !this.#startDate.equals(this.oldStartDate ?? DateTime) || this.#endDate && !this.singleDatePicker && !this.#endDate.equals(this.oldEndDate ?? DateTime))
|
|
1661
|
+
this.callback(this.startDate, this.endDate, this.chosenLabel);
|
|
1662
|
+
}
|
|
1660
1663
|
this.updateElement();
|
|
1661
1664
|
const event = this.triggerEvent(this.#events.onBeforeHide);
|
|
1662
1665
|
if (event.defaultPrevented)
|