@wernfried/daterangepicker 5.2.6 → 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 +15 -15
- 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 +15 -15
- 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 +15 -15
- 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
package/API_Doc.md
CHANGED
|
@@ -635,14 +635,14 @@ Options for DateRangePicker
|
|
|
635
635
|
| Name | Type | Default | Description |
|
|
636
636
|
| --- | --- | --- | --- |
|
|
637
637
|
| parentEl | <code>string</code> \| [<code>HTMLElement</code>](https://developer.mozilla.org/de/docs/Web/API/HTMLElement) | <code>"body"</code> | [Document querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector#selectors) or `HTMLElement` of the parent element that the date range picker will be added to |
|
|
638
|
-
| startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | Default: `DateTime.now().startOf('day')`<br>The beginning date of the initially selected date range.<br> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`.<br> Date value is rounded to match option `timePickerStepSize`<br> Option `isInvalidDate` and `isInvalidTime` are not evaluated, you may set date/time which is not selectable in calendar.<br> If the date does not fall into `minDate` and `maxDate` then date is shifted and a warning is written to console.<br> Use `startDate: null` to show calendar without an
|
|
638
|
+
| startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | Default: `DateTime.now().startOf('day')`<br>The beginning date of the initially selected date range.<br> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`.<br> Date value is rounded to match option `timePickerStepSize`<br> Option `isInvalidDate` and `isInvalidTime` are not evaluated, you may set date/time which is not selectable in calendar.<br> If the date does not fall into `minDate` and `maxDate` then date is shifted and a warning is written to console.<br> Use `startDate: null` to show calendar without an initial selected date. |
|
|
639
639
|
| endDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> | | Defautl: `DateTime.now().endOf('day')`<br>The end date of the initially selected date range.<br> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`.<br> Date value is rounded to match option `timePickerStepSize`<br> Option `isInvalidDate`, `isInvalidTime` and `minSpan`, `maxSpan` are not evaluated, you may set date/time which is not selectable in calendar.<br> If the date does not fall into `minDate` and `maxDate` then date is shifted and a warning is written to console.<br> |
|
|
640
640
|
| minDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | The earliest date a user may select or `null` for no limit.<br> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`. |
|
|
641
641
|
| maxDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | The latest date a user may select or `null` for no limit.<br> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`. |
|
|
642
642
|
| minSpan | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> \| <code>null</code> | | The minimum span between the selected start and end dates.<br> Must be a `luxon.Duration` or number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br> Ignored when `singleDatePicker: true` |
|
|
643
643
|
| maxSpan | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> \| <code>null</code> | | The maximum span between the selected start and end dates.<br> Must be a `luxon.Duration` or number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br> Ignored when `singleDatePicker: true` |
|
|
644
644
|
| defaultSpan | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> \| <code>null</code> | | The span which is used when endDate is automatically updated due to wrong user input<br> Must be a `luxon.Duration` or number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br> Ignored when `singleDatePicker: true`. Not relevant if `minSpan: null` |
|
|
645
|
-
|
|
|
645
|
+
| initialMonth | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | Default: `DateTime.now().startOf('month')`<br> The inital month to be shown. Only relevant for `startDate: null`. Be aware, the attached `<input>` element must also be empty.<br> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`.<br> Works only with `timePicker: false` |
|
|
646
646
|
| autoApply | <code>boolean</code> | <code>false</code> | Hide the `Apply` and `Cancel` buttons, and automatically apply a new date range as soon as two dates are clicked.<br> Only useful when `timePicker: false` |
|
|
647
647
|
| singleDatePicker | <code>boolean</code> | <code>false</code> | Show only a single calendar to choose one date, instead of a range picker with two calendars.<br> If `true`, then `endDate` is always `null`. |
|
|
648
648
|
| singleMonthView | <code>boolean</code> | <code>false</code> | Show only a single month calendar, useful when selected ranges are usually short<br> or for smaller viewports like mobile devices.<br> Ignored for `singleDatePicker: true`. |
|
package/README.md
CHANGED
|
@@ -19,8 +19,8 @@ Above samples are based on the [original repository](https://github.com/dangross
|
|
|
19
19
|
#### Global import with `<script>` tags
|
|
20
20
|
```html
|
|
21
21
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
|
|
22
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.
|
|
23
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.
|
|
22
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.8/dist/global/daterangepicker.min.js"></script>
|
|
23
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.8/css/daterangepicker.min.css" rel="stylesheet" />
|
|
24
24
|
|
|
25
25
|
<input type="text" id="picker" />
|
|
26
26
|
|
|
@@ -40,11 +40,11 @@ Above samples are based on the [original repository](https://github.com/dangross
|
|
|
40
40
|
{
|
|
41
41
|
"imports": {
|
|
42
42
|
"luxon": "https://cdn.jsdelivr.net/npm/luxon@3.7.2/+esm",
|
|
43
|
-
"daterangepicker": "https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.
|
|
43
|
+
"daterangepicker": "https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.8/+esm"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
</script>
|
|
47
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.
|
|
47
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.8/css/daterangepicker.min.css" rel="stylesheet" />
|
|
48
48
|
|
|
49
49
|
<input type="text" id="picker" />
|
|
50
50
|
|
|
@@ -63,9 +63,9 @@ Above samples are based on the [original repository](https://github.com/dangross
|
|
|
63
63
|
#### Style with Bulma
|
|
64
64
|
```html
|
|
65
65
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
|
|
66
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.
|
|
66
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.8/dist/global/daterangepicker.min.js"></script>
|
|
67
67
|
<link type="text/css" href="https://cdn.jsdelivr.net/npm/bulma@1.0.4/css/bulma.min.css" rel="stylesheet" />
|
|
68
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.
|
|
68
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.8/css/daterangepicker.bulma.min.css" rel="stylesheet" />
|
|
69
69
|
|
|
70
70
|
<input type="text" id="picker" />
|
|
71
71
|
|
|
@@ -121,8 +121,8 @@ Initialisation with jQuery is supported in version 5.x
|
|
|
121
121
|
```html
|
|
122
122
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
|
|
123
123
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
|
|
124
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.
|
|
125
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.
|
|
124
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.8/dist/global/daterangepicker.min.js"></script>
|
|
125
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.8/css/daterangepicker.min.css" rel="stylesheet" />
|
|
126
126
|
|
|
127
127
|
<input type="text" id="picker" />
|
|
128
128
|
|
|
@@ -349,14 +349,14 @@ Options for DateRangePicker
|
|
|
349
349
|
| Name | Type | Default | Description |
|
|
350
350
|
| --- | --- | --- | --- |
|
|
351
351
|
| parentEl | <code>string</code> \| [<code>HTMLElement</code>](https://developer.mozilla.org/de/docs/Web/API/HTMLElement) | <code>"body"</code> | [Document querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector#selectors) or `HTMLElement` of the parent element that the date range picker will be added to |
|
|
352
|
-
| startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | Default: `DateTime.now().startOf('day')`<br>The beginning date of the initially selected date range.<br> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`.<br> Date value is rounded to match option `timePickerStepSize`<br> Option `isInvalidDate` and `isInvalidTime` are not evaluated, you may set date/time which is not selectable in calendar.<br> If the date does not fall into `minDate` and `maxDate` then date is shifted and a warning is written to console.<br> Use `startDate: null` to show calendar without an
|
|
352
|
+
| startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | Default: `DateTime.now().startOf('day')`<br>The beginning date of the initially selected date range.<br> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`.<br> Date value is rounded to match option `timePickerStepSize`<br> Option `isInvalidDate` and `isInvalidTime` are not evaluated, you may set date/time which is not selectable in calendar.<br> If the date does not fall into `minDate` and `maxDate` then date is shifted and a warning is written to console.<br> Use `startDate: null` to show calendar without an initial selected date. |
|
|
353
353
|
| endDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> | | Defautl: `DateTime.now().endOf('day')`<br>The end date of the initially selected date range.<br> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`.<br> Date value is rounded to match option `timePickerStepSize`<br> Option `isInvalidDate`, `isInvalidTime` and `minSpan`, `maxSpan` are not evaluated, you may set date/time which is not selectable in calendar.<br> If the date does not fall into `minDate` and `maxDate` then date is shifted and a warning is written to console.<br> |
|
|
354
354
|
| minDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | The earliest date a user may select or `null` for no limit.<br> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`. |
|
|
355
355
|
| maxDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | The latest date a user may select or `null` for no limit.<br> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`. |
|
|
356
356
|
| minSpan | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> \| <code>null</code> | | The minimum span between the selected start and end dates.<br> Must be a `luxon.Duration` or number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br> Ignored when `singleDatePicker: true` |
|
|
357
357
|
| maxSpan | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> \| <code>null</code> | | The maximum span between the selected start and end dates.<br> Must be a `luxon.Duration` or number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br> Ignored when `singleDatePicker: true` |
|
|
358
358
|
| defaultSpan | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> \| <code>null</code> | | The span which is used when endDate is automatically updated due to wrong user input<br> Must be a `luxon.Duration` or number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br> Ignored when `singleDatePicker: true`. Not relevant if `minSpan: null` |
|
|
359
|
-
|
|
|
359
|
+
| initialMonth | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | Default: `DateTime.now().startOf('month')`<br> The inital month to be shown. Only relevant for `startDate: null`. Be aware, the attached `<input>` element must also be empty.<br> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`.<br> Works only with `timePicker: false` |
|
|
360
360
|
| autoApply | <code>boolean</code> | <code>false</code> | Hide the `Apply` and `Cancel` buttons, and automatically apply a new date range as soon as two dates are clicked.<br> Only useful when `timePicker: false` |
|
|
361
361
|
| singleDatePicker | <code>boolean</code> | <code>false</code> | Show only a single calendar to choose one date, instead of a range picker with two calendars.<br> If `true`, then `endDate` is always `null`. |
|
|
362
362
|
| singleMonthView | <code>boolean</code> | <code>false</code> | Show only a single month calendar, useful when selected ranges are usually short<br> or for smaller viewports like mobile devices.<br> Ignored for `singleDatePicker: true`. |
|
|
@@ -16,7 +16,7 @@ class DateRangePicker {
|
|
|
16
16
|
this.maxSpan = null;
|
|
17
17
|
this.minSpan = null;
|
|
18
18
|
this.defaultSpan = null;
|
|
19
|
-
this.
|
|
19
|
+
this.initialMonth = luxon.DateTime.now().startOf("month");
|
|
20
20
|
this.autoApply = false;
|
|
21
21
|
this.singleDatePicker = false;
|
|
22
22
|
this.singleMonthView = false;
|
|
@@ -81,7 +81,7 @@ class DateRangePicker {
|
|
|
81
81
|
if (!Object.keys(this).concat(["startDate", "endDate"]).includes(name) || Object.keys(options).includes(name))
|
|
82
82
|
continue;
|
|
83
83
|
let ts = luxon.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 @@ class DateRangePicker {
|
|
|
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 @@ class DateRangePicker {
|
|
|
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) {
|
|
@@ -764,7 +764,7 @@ class DateRangePicker {
|
|
|
764
764
|
*/
|
|
765
765
|
setStartDate(startDate, updateView = true) {
|
|
766
766
|
if (!this.singleDatePicker)
|
|
767
|
-
return setRange(startDate, this.#endDate, updateView);
|
|
767
|
+
return this.setRange(startDate, this.#endDate, updateView);
|
|
768
768
|
const oldDate = this.#startDate;
|
|
769
769
|
let newDate = this.parseDate(startDate);
|
|
770
770
|
if (newDate.equals(oldDate))
|
|
@@ -801,7 +801,7 @@ class DateRangePicker {
|
|
|
801
801
|
* drp.setEndDate(DateTime.now().startOf('hour'));
|
|
802
802
|
*/
|
|
803
803
|
setEndDate(endDate, updateView = true) {
|
|
804
|
-
return this.singleDatePicker ? null : setRange(this.#startDate, endDate, updateView);
|
|
804
|
+
return this.singleDatePicker ? null : this.setRange(this.#startDate, endDate, updateView);
|
|
805
805
|
}
|
|
806
806
|
/**
|
|
807
807
|
* Sets the date range picker's currently selected start date to the provided date.<br>
|
|
@@ -1153,10 +1153,10 @@ class DateRangePicker {
|
|
|
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 @@ class DateRangePicker {
|
|
|
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 @@ class DateRangePicker {
|
|
|
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 @@ class DateRangePicker {
|
|
|
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 @@ class DateRangePicker {
|
|
|
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);
|