@wernfried/daterangepicker 5.2.7 → 5.2.8
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/API_Doc.md +2 -2
- package/README.md +10 -10
- package/dist/cjs/daterangepicker.cjs +13 -13
- 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 +13 -13
- 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 +13 -13
- 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 +1 -1
|
@@ -16,7 +16,7 @@ var DateRangePicker = (function(exports, luxon2) {
|
|
|
16
16
|
this.maxSpan = null;
|
|
17
17
|
this.minSpan = null;
|
|
18
18
|
this.defaultSpan = null;
|
|
19
|
-
this.
|
|
19
|
+
this.initialMonth = luxon2.DateTime.now().startOf("month");
|
|
20
20
|
this.autoApply = false;
|
|
21
21
|
this.singleDatePicker = false;
|
|
22
22
|
this.singleMonthView = false;
|
|
@@ -81,7 +81,7 @@ var DateRangePicker = (function(exports, luxon2) {
|
|
|
81
81
|
if (!Object.keys(this).concat(["startDate", "endDate"]).includes(name) || Object.keys(options).includes(name))
|
|
82
82
|
continue;
|
|
83
83
|
let ts = luxon2.DateTime.fromISO(item.value);
|
|
84
|
-
const isDate = ["startDate", "endDate", "minDate", "maxDate", "
|
|
84
|
+
const isDate = ["startDate", "endDate", "minDate", "maxDate", "initialMonth"].includes(name);
|
|
85
85
|
dataOptions[name] = ts.isValid && isDate ? ts : JSON.parse(item.value);
|
|
86
86
|
}
|
|
87
87
|
options = { ...dataOptions, ...options };
|
|
@@ -296,7 +296,7 @@ var DateRangePicker = (function(exports, luxon2) {
|
|
|
296
296
|
secondStep: this.timePickerStepSize.seconds
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
-
for (let opt of ["startDate", "endDate", "minDate", "maxDate", "
|
|
299
|
+
for (let opt of ["startDate", "endDate", "minDate", "maxDate", "initialMonth"]) {
|
|
300
300
|
if (opt === "endDate" && this.singleDatePicker)
|
|
301
301
|
continue;
|
|
302
302
|
if (typeof options[opt] === "object") {
|
|
@@ -359,10 +359,10 @@ var DateRangePicker = (function(exports, luxon2) {
|
|
|
359
359
|
if (this.#startDate) this.#startDate = this.#startDate.startOf("day");
|
|
360
360
|
if (this.#endDate) this.#endDate = this.#endDate.endOf("day");
|
|
361
361
|
}
|
|
362
|
-
if (!this.#startDate && this.
|
|
362
|
+
if (!this.#startDate && this.initialMonth) {
|
|
363
363
|
this.#endDate = null;
|
|
364
364
|
if (this.timePicker)
|
|
365
|
-
console.error(`Option '
|
|
365
|
+
console.error(`Option 'initialMonth' works only with 'timePicker: false'`);
|
|
366
366
|
} else {
|
|
367
367
|
const violations = this.validateInput(null, false);
|
|
368
368
|
if (violations != null) {
|
|
@@ -1153,10 +1153,10 @@ var DateRangePicker = (function(exports, luxon2) {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
}
|
|
1155
1155
|
} else {
|
|
1156
|
-
if (!this.#startDate && this.
|
|
1157
|
-
this.leftCalendar.month = this.
|
|
1156
|
+
if (!this.#startDate && this.initialMonth) {
|
|
1157
|
+
this.leftCalendar.month = this.initialMonth;
|
|
1158
1158
|
if (!this.singleMonthView)
|
|
1159
|
-
this.rightCalendar.month = this.
|
|
1159
|
+
this.rightCalendar.month = this.initialMonth.plus({ month: 1 });
|
|
1160
1160
|
} else {
|
|
1161
1161
|
if (!this.leftCalendar.month.hasSame(this.#startDate, "month") && !this.rightCalendar.month.hasSame(this.#startDate, "month")) {
|
|
1162
1162
|
this.leftCalendar.month = this.#startDate.startOf("month");
|
|
@@ -1239,8 +1239,8 @@ var DateRangePicker = (function(exports, luxon2) {
|
|
|
1239
1239
|
if (side === "right" && this.singleMonthView)
|
|
1240
1240
|
return;
|
|
1241
1241
|
var calendar = side === "left" ? this.leftCalendar : this.rightCalendar;
|
|
1242
|
-
if (calendar.month == null && !this.#startDate && this.
|
|
1243
|
-
calendar.month = this.
|
|
1242
|
+
if (calendar.month == null && !this.#startDate && this.initialMonth)
|
|
1243
|
+
calendar.month = this.initialMonth.startOf("month");
|
|
1244
1244
|
const firstDay = calendar.month.startOf("month");
|
|
1245
1245
|
const lastDay = calendar.month.endOf("month").startOf("day");
|
|
1246
1246
|
var theDate = calendar.month.startOf("month").minus({ day: 1 });
|
|
@@ -1780,7 +1780,7 @@ var DateRangePicker = (function(exports, luxon2) {
|
|
|
1780
1780
|
const leftCalendar = this.leftCalendar;
|
|
1781
1781
|
const rightCalendar = this.rightCalendar;
|
|
1782
1782
|
const startDate = this.#startDate;
|
|
1783
|
-
const
|
|
1783
|
+
const initialMonth = this.initialMonth;
|
|
1784
1784
|
if (!this.#endDate) {
|
|
1785
1785
|
this.container.querySelectorAll(".drp-calendar tbody td").forEach((el) => {
|
|
1786
1786
|
if (el.classList.contains("week")) return;
|
|
@@ -1789,7 +1789,7 @@ var DateRangePicker = (function(exports, luxon2) {
|
|
|
1789
1789
|
const col2 = title2.substring(3, 4);
|
|
1790
1790
|
const cal2 = el.closest(".drp-calendar");
|
|
1791
1791
|
const dt = cal2.classList.contains("left") ? leftCalendar.calendar[row2][col2] : rightCalendar.calendar[row2][col2];
|
|
1792
|
-
if (!startDate &&
|
|
1792
|
+
if (!startDate && initialMonth) {
|
|
1793
1793
|
el.classList.remove("in-range");
|
|
1794
1794
|
} else {
|
|
1795
1795
|
el.classList.toggle("in-range", dt > startDate && dt < date || dt.hasSame(date, "day"));
|
|
@@ -2180,7 +2180,7 @@ var DateRangePicker = (function(exports, luxon2) {
|
|
|
2180
2180
|
* @emits external:change
|
|
2181
2181
|
*/
|
|
2182
2182
|
updateElement() {
|
|
2183
|
-
if (this.#startDate == null && this.
|
|
2183
|
+
if (this.#startDate == null && this.initialMonth)
|
|
2184
2184
|
return;
|
|
2185
2185
|
if (this.isInputText) {
|
|
2186
2186
|
let newValue = this.formatDate(this.#startDate);
|