@wernfried/daterangepicker 5.2.7 → 5.2.10
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 +47 -44
- 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 +47 -44
- 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 +47 -44
- 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.10/dist/global/daterangepicker.min.js"></script>
|
|
23
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.10/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.10/+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.10/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.10/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.10/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.10/dist/global/daterangepicker.min.js"></script>
|
|
125
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.2.10/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) {
|
|
@@ -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 });
|
|
@@ -1397,6 +1397,7 @@ class DateRangePicker {
|
|
|
1397
1397
|
if (maxDate && selected > maxDate)
|
|
1398
1398
|
selected = maxDate;
|
|
1399
1399
|
}
|
|
1400
|
+
let disabled = { hour: false, minute: false, second: false, ampm: false };
|
|
1400
1401
|
html += `<th colspan="7">`;
|
|
1401
1402
|
if (this.externalStyle === "bulma")
|
|
1402
1403
|
html += '<div class="select is-small mx-1">';
|
|
@@ -1407,19 +1408,18 @@ class DateRangePicker {
|
|
|
1407
1408
|
start = ampm === "AM" ? 1 : 13;
|
|
1408
1409
|
for (var i = start; i <= start + 23; i += this.timePickerOpts.hourStep) {
|
|
1409
1410
|
let time = selected.set({ hour: i % 24 });
|
|
1410
|
-
let disabled = false;
|
|
1411
1411
|
if (minDate && time.set({ minute: 59 }) < minDate)
|
|
1412
|
-
disabled = true;
|
|
1412
|
+
disabled.hour = true;
|
|
1413
1413
|
if (maxDate && time.set({ minute: 0 }) > maxDate)
|
|
1414
|
-
disabled = true;
|
|
1414
|
+
disabled.hour = true;
|
|
1415
1415
|
if (minLimit && time.endOf("hour") < minLimit)
|
|
1416
|
-
disabled = true;
|
|
1417
|
-
if (!disabled && this.isInvalidTime(time, this.singleDatePicker ? null : side, "hour"))
|
|
1418
|
-
disabled = true;
|
|
1416
|
+
disabled.hour = true;
|
|
1417
|
+
if (!disabled.hour && this.isInvalidTime(time, this.singleDatePicker ? null : side, "hour"))
|
|
1418
|
+
disabled.hour = true;
|
|
1419
1419
|
if (this.timePicker24Hour) {
|
|
1420
|
-
if (!disabled && i == selected.hour) {
|
|
1420
|
+
if (!disabled.hour && i == selected.hour) {
|
|
1421
1421
|
html += `<option value="${i}" selected>${i}</option>`;
|
|
1422
|
-
} else if (disabled) {
|
|
1422
|
+
} else if (disabled.hour) {
|
|
1423
1423
|
html += `<option value="${i}" disabled class="disabled">${i}</option>`;
|
|
1424
1424
|
} else {
|
|
1425
1425
|
html += `<option value="${i}">${i}</option>`;
|
|
@@ -1428,9 +1428,9 @@ class DateRangePicker {
|
|
|
1428
1428
|
const i_12 = luxon.DateTime.fromFormat(`${i % 24}`, "H").toFormat("h");
|
|
1429
1429
|
const i_ampm = luxon.DateTime.fromFormat(`${i % 24}`, "H").toFormat("a", { locale: "en-US" });
|
|
1430
1430
|
if (ampm == i_ampm) {
|
|
1431
|
-
if (!disabled && i == selected.hour) {
|
|
1431
|
+
if (!disabled.hour && i == selected.hour) {
|
|
1432
1432
|
html += `<option ampm="${i_ampm}" value="${i % 24}" selected>${i_12}</option>`;
|
|
1433
|
-
} else if (disabled) {
|
|
1433
|
+
} else if (disabled.hour) {
|
|
1434
1434
|
html += `<option ampm="${i_ampm}" value="${i % 24}" disabled class="disabled">${i_12}</option>`;
|
|
1435
1435
|
} else {
|
|
1436
1436
|
html += `<option ampm="${i_ampm}" value="${i % 24}">${i_12}</option>`;
|
|
@@ -1451,18 +1451,19 @@ class DateRangePicker {
|
|
|
1451
1451
|
for (var i = 0; i < 60; i += this.timePickerOpts.minuteStep) {
|
|
1452
1452
|
var padded = i < 10 ? "0" + i : i;
|
|
1453
1453
|
let time = selected.set({ minute: i });
|
|
1454
|
-
|
|
1454
|
+
if (disabled.hour)
|
|
1455
|
+
disabled.minute = true;
|
|
1455
1456
|
if (minDate && time.set({ second: 59 }) < minDate)
|
|
1456
|
-
disabled = true;
|
|
1457
|
+
disabled.minute = true;
|
|
1457
1458
|
if (maxDate && time.set({ second: 0 }) > maxDate)
|
|
1458
|
-
disabled = true;
|
|
1459
|
+
disabled.minute = true;
|
|
1459
1460
|
if (minLimit && time.endOf("minute") < minLimit)
|
|
1460
|
-
disabled = true;
|
|
1461
|
-
if (!disabled && this.isInvalidTime(time, this.singleDatePicker ? null : side, "minute"))
|
|
1462
|
-
disabled = true;
|
|
1463
|
-
if (selected.minute == i && !disabled) {
|
|
1461
|
+
disabled.minute = true;
|
|
1462
|
+
if (!disabled.minute && this.isInvalidTime(time, this.singleDatePicker ? null : side, "minute"))
|
|
1463
|
+
disabled.minute = true;
|
|
1464
|
+
if (selected.minute == i && !disabled.minute) {
|
|
1464
1465
|
html += `<option value="${i}" selected>${padded}</option>`;
|
|
1465
|
-
} else if (disabled) {
|
|
1466
|
+
} else if (disabled.minute) {
|
|
1466
1467
|
html += `<option value="${i}" disabled class="disabled">${padded}</option>`;
|
|
1467
1468
|
} else {
|
|
1468
1469
|
html += `<option value="${i}">${padded}</option>`;
|
|
@@ -1480,18 +1481,19 @@ class DateRangePicker {
|
|
|
1480
1481
|
for (var i = 0; i < 60; i += this.timePickerOpts.secondStep) {
|
|
1481
1482
|
var padded = i < 10 ? "0" + i : i;
|
|
1482
1483
|
let time = selected.set({ second: i });
|
|
1483
|
-
|
|
1484
|
+
if (disabled.minute)
|
|
1485
|
+
disabled.second = true;
|
|
1484
1486
|
if (minDate && time < minDate)
|
|
1485
|
-
disabled = true;
|
|
1487
|
+
disabled.second = true;
|
|
1486
1488
|
if (maxDate && time > maxDate)
|
|
1487
|
-
disabled = true;
|
|
1489
|
+
disabled.second = true;
|
|
1488
1490
|
if (minLimit && time < minLimit)
|
|
1489
|
-
disabled = true;
|
|
1490
|
-
if (!disabled && this.isInvalidTime(time, this.singleDatePicker ? null : side, "second"))
|
|
1491
|
-
disabled = true;
|
|
1492
|
-
if (selected.second == i && !disabled) {
|
|
1491
|
+
disabled.second = true;
|
|
1492
|
+
if (!disabled.second && this.isInvalidTime(time, this.singleDatePicker ? null : side, "second"))
|
|
1493
|
+
disabled.second = true;
|
|
1494
|
+
if (selected.second == i && !disabled.second) {
|
|
1493
1495
|
html += `<option value="${i}" selected>${padded}</option>`;
|
|
1494
|
-
} else if (disabled) {
|
|
1496
|
+
} else if (disabled.second) {
|
|
1495
1497
|
html += `<option value="${i}" disabled class="disabled">${padded}</option>`;
|
|
1496
1498
|
} else {
|
|
1497
1499
|
html += `<option value="${i}">${padded}</option>`;
|
|
@@ -1507,14 +1509,15 @@ class DateRangePicker {
|
|
|
1507
1509
|
html += '<select class="ampmselect">';
|
|
1508
1510
|
var am_html = "";
|
|
1509
1511
|
var pm_html = "";
|
|
1510
|
-
|
|
1512
|
+
if (disabled.hour)
|
|
1513
|
+
disabled.ampm = true;
|
|
1511
1514
|
if (minDate && selected.startOf("day") < minDate)
|
|
1512
|
-
disabled = true;
|
|
1515
|
+
disabled.ampm = true;
|
|
1513
1516
|
if (maxDate && selected.endOf("day") > maxDate)
|
|
1514
|
-
disabled = true;
|
|
1517
|
+
disabled.ampm = true;
|
|
1515
1518
|
if (minLimit && selected.startOf("day") < minLimit)
|
|
1516
|
-
disabled = true;
|
|
1517
|
-
if (disabled) {
|
|
1519
|
+
disabled.ampm = true;
|
|
1520
|
+
if (disabled.ampm) {
|
|
1518
1521
|
am_html = ' disabled class="disabled "';
|
|
1519
1522
|
pm_html = ' disabled class="disabled"';
|
|
1520
1523
|
} else {
|
|
@@ -1780,7 +1783,7 @@ class DateRangePicker {
|
|
|
1780
1783
|
const leftCalendar = this.leftCalendar;
|
|
1781
1784
|
const rightCalendar = this.rightCalendar;
|
|
1782
1785
|
const startDate = this.#startDate;
|
|
1783
|
-
const
|
|
1786
|
+
const initialMonth = this.initialMonth;
|
|
1784
1787
|
if (!this.#endDate) {
|
|
1785
1788
|
this.container.querySelectorAll(".drp-calendar tbody td").forEach((el) => {
|
|
1786
1789
|
if (el.classList.contains("week")) return;
|
|
@@ -1789,7 +1792,7 @@ class DateRangePicker {
|
|
|
1789
1792
|
const col2 = title2.substring(3, 4);
|
|
1790
1793
|
const cal2 = el.closest(".drp-calendar");
|
|
1791
1794
|
const dt = cal2.classList.contains("left") ? leftCalendar.calendar[row2][col2] : rightCalendar.calendar[row2][col2];
|
|
1792
|
-
if (!startDate &&
|
|
1795
|
+
if (!startDate && initialMonth) {
|
|
1793
1796
|
el.classList.remove("in-range");
|
|
1794
1797
|
} else {
|
|
1795
1798
|
el.classList.toggle("in-range", dt > startDate && dt < date || dt.hasSame(date, "day"));
|
|
@@ -2180,7 +2183,7 @@ class DateRangePicker {
|
|
|
2180
2183
|
* @emits external:change
|
|
2181
2184
|
*/
|
|
2182
2185
|
updateElement() {
|
|
2183
|
-
if (this.#startDate == null && this.
|
|
2186
|
+
if (this.#startDate == null && this.initialMonth)
|
|
2184
2187
|
return;
|
|
2185
2188
|
if (this.isInputText) {
|
|
2186
2189
|
let newValue = this.formatDate(this.#startDate);
|