@wernfried/daterangepicker 5.7.0 → 5.8.0
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 +8 -6
- package/README.md +10 -10
- package/dist/cjs/daterangepicker.cjs +62 -33
- 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 +63 -34
- 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 +62 -33
- 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
|
@@ -119,8 +119,8 @@ Ranges are not validated against <code>minDate</code>, <code>maxDate</code>, <co
|
|
|
119
119
|
* [.updateAltInput()](#DateRangePicker+updateAltInput)
|
|
120
120
|
* [.remove()](#DateRangePicker+remove)
|
|
121
121
|
* [.triggerEvent(ev, ...args)](#DateRangePicker+triggerEvent)
|
|
122
|
-
* [.addEventListener(type, listener, [options])](#DateRangePicker+addEventListener)
|
|
123
|
-
* [.removeEventListener(type, listener, [options])](#DateRangePicker+removeEventListener)
|
|
122
|
+
* [.addEventListener(type, listener, [options])](#DateRangePicker+addEventListener) ⇒ [<code>DateRangePicker</code>](#DateRangePicker)
|
|
123
|
+
* [.removeEventListener(type, listener, [options])](#DateRangePicker+removeEventListener) ⇒ [<code>DateRangePicker</code>](#DateRangePicker)
|
|
124
124
|
|
|
125
125
|
<a name="new_DateRangePicker_new"></a>
|
|
126
126
|
|
|
@@ -376,11 +376,12 @@ Helper function to dispatch events
|
|
|
376
376
|
|
|
377
377
|
<a name="DateRangePicker+addEventListener"></a>
|
|
378
378
|
|
|
379
|
-
### dateRangePicker.addEventListener(type, listener, [options])
|
|
379
|
+
### dateRangePicker.addEventListener(type, listener, [options]) ⇒ [<code>DateRangePicker</code>](#DateRangePicker)
|
|
380
380
|
Adding event listener to input element where dateragnepicker is attached to.
|
|
381
381
|
Wrapper to give easy access for `addEventListener()` on DateRangePicker instance.
|
|
382
382
|
|
|
383
383
|
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
384
|
+
**Returns**: [<code>DateRangePicker</code>](#DateRangePicker) - - The DateRangePicker instance, usefull for chaining
|
|
384
385
|
|
|
385
386
|
| Param | Type | Description |
|
|
386
387
|
| --- | --- | --- |
|
|
@@ -396,11 +397,12 @@ picker.addEventListener('hide', (e) => {
|
|
|
396
397
|
```
|
|
397
398
|
<a name="DateRangePicker+removeEventListener"></a>
|
|
398
399
|
|
|
399
|
-
### dateRangePicker.removeEventListener(type, listener, [options])
|
|
400
|
+
### dateRangePicker.removeEventListener(type, listener, [options]) ⇒ [<code>DateRangePicker</code>](#DateRangePicker)
|
|
400
401
|
Counterpart to `addEventListener()`
|
|
401
402
|
Note, `listener` most be a named function to enable remove.
|
|
402
403
|
|
|
403
404
|
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
405
|
+
**Returns**: [<code>DateRangePicker</code>](#DateRangePicker) - - The DateRangePicker instance, usefull for chaining
|
|
404
406
|
|
|
405
407
|
| Param | Type | Description |
|
|
406
408
|
| --- | --- | --- |
|
|
@@ -712,8 +714,8 @@ Options for DateRangePicker
|
|
|
712
714
|
| isInvalidDate | <code>function</code> | <code>false</code> | A function that is passed each date in the two calendars before they are displayed,<br> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br> Signature: `isInvalidDate(date)`<br> |
|
|
713
715
|
| isInvalidTime | <code>function</code> | <code>false</code> | A function that is passed each hour/minute/second/am-pm in the two calendars before they are displayed,<br> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br> Signature: `isInvalidTime(time, side, unit)`<br> `side` is `'start'` or `'end'` or `null` for `singleDatePicker: true`<br> `unit` is `'hour'`, `'minute'`, `'second'` or `'ampm'`<br> Hours are always given as 24-hour clock<br> Ensure that your function returns `false` for at least one item. Otherwise the calender is not rendered.<br> |
|
|
714
716
|
| isCustomDate | <code>function</code> | <code>false</code> | A function that is passed each date in the two calendars before they are displayed, and may return a string or array of CSS class names to apply to that date's calendar cell.<br> Signature: `isCustomDate(date)` |
|
|
715
|
-
| altInput | <code>string</code> \| <code>Array</code> \| [<code>HTMLInputElement</code>](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | <code>null</code> | A [Document querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector#selectors)<br> string or `
|
|
716
|
-
| altFormat | <code>function</code> \| <code>string</code> | | The output format used for `altInput`.<br>
|
|
717
|
+
| altInput | <code>string</code> \| <code>Array</code> \| [<code>HTMLInputElement</code>](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) \| [<code>HTMLCollection</code>](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection) | <code>null</code> | A [Document querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector#selectors)<br> string matching a single `<input>` element or an `HTMLInputElement` for the alternative output. Uses `altFormat` to format the value.<br> For `singleDatePicker: false` you may provide:<br> - A CSS querySelector string matching exactly two `<input>` elements (e.g., `'.start-date, .end-date'`)<br> - An array of two strings or `HTMLInputElement` elements<br> - An `HTMLCollection` of two `HTMLInputElement` elements<br> Uses `altFormat` to format the values.<br> Examples: `'#start, #end'`, `['#start', '#end']`, or `[startInput, endInput]` |
|
|
718
|
+
| altFormat | <code>function</code> \| <code>string</code> \| <code>object</code> | | The output format used for `altInput`.<br> Either a string of [Format tokens](https://moment.github.io/luxon/#/formatting?id=table-of-tokens) or [DateTime.toISO()](https://moment.github.io/luxon/api-docs/index.html#datetimetoiso) opts object or a function.<br> Default: `{format: 'extended', precision: <derived from timePickerStepSize>, includeOffset: false}`<br> Examples: `"yyyy:MM:dd'T'HH:mm"`<br> `(date) => date.toUnixInteger()` for singleDatePicker: true or altInput[]<br> `(interval) => interval.toISO('yyyy:MM:dd', {separator: '..'})` for singleDatePicker: false and single altInput |
|
|
717
719
|
| applyButtonClasses | <code>string</code> | <code>"btn-primary"</code> | CSS class names that will be added only to the apply button |
|
|
718
720
|
| cancelButtonClasses | <code>string</code> | <code>"btn-default"</code> | CSS class names that will be added only to the cancel button |
|
|
719
721
|
| buttonClasses | <code>string</code> | | Default: `'btn btn-sm'`<br>CSS class names that will be added to both the apply and cancel buttons. |
|
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.
|
|
23
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.
|
|
22
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.8.0/dist/global/daterangepicker.min.js"></script>
|
|
23
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.8.0/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.
|
|
43
|
+
"daterangepicker": "https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.8.0/+esm"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
</script>
|
|
47
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.
|
|
47
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.8.0/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.
|
|
66
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.8.0/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.
|
|
68
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.8.0/css/daterangepicker.bulma.min.css" rel="stylesheet" />
|
|
69
69
|
|
|
70
70
|
<input type="text" id="picker" />
|
|
71
71
|
|
|
@@ -122,8 +122,8 @@ Initialisation with jQuery is supported in version 5.x
|
|
|
122
122
|
```html
|
|
123
123
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
|
|
124
124
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
|
|
125
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.
|
|
126
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.
|
|
125
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.8.0/dist/global/daterangepicker.min.js"></script>
|
|
126
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@5.8.0/css/daterangepicker.min.css" rel="stylesheet" />
|
|
127
127
|
|
|
128
128
|
<input type="text" id="picker" />
|
|
129
129
|
|
|
@@ -377,8 +377,8 @@ Options for DateRangePicker
|
|
|
377
377
|
| isInvalidDate | <code>function</code> | <code>false</code> | A function that is passed each date in the two calendars before they are displayed,<br> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br> Signature: `isInvalidDate(date)`<br> |
|
|
378
378
|
| isInvalidTime | <code>function</code> | <code>false</code> | A function that is passed each hour/minute/second/am-pm in the two calendars before they are displayed,<br> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br> Signature: `isInvalidTime(time, side, unit)`<br> `side` is `'start'` or `'end'` or `null` for `singleDatePicker: true`<br> `unit` is `'hour'`, `'minute'`, `'second'` or `'ampm'`<br> Hours are always given as 24-hour clock<br> Ensure that your function returns `false` for at least one item. Otherwise the calender is not rendered.<br> |
|
|
379
379
|
| isCustomDate | <code>function</code> | <code>false</code> | A function that is passed each date in the two calendars before they are displayed, and may return a string or array of CSS class names to apply to that date's calendar cell.<br> Signature: `isCustomDate(date)` |
|
|
380
|
-
| altInput | <code>string</code> \| <code>Array</code> \| [<code>HTMLInputElement</code>](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | <code>null</code> | A [Document querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector#selectors)<br> string or `
|
|
381
|
-
| altFormat | <code>function</code> \| <code>string</code> | | The output format used for `altInput`.<br>
|
|
380
|
+
| altInput | <code>string</code> \| <code>Array</code> \| [<code>HTMLInputElement</code>](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) \| [<code>HTMLCollection</code>](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection) | <code>null</code> | A [Document querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector#selectors)<br> string matching a single `<input>` element or an `HTMLInputElement` for the alternative output. Uses `altFormat` to format the value.<br> For `singleDatePicker: false` you may provide:<br> - A CSS querySelector string matching exactly two `<input>` elements (e.g., `'.start-date, .end-date'`)<br> - An array of two strings or `HTMLInputElement` elements<br> - An `HTMLCollection` of two `HTMLInputElement` elements<br> Uses `altFormat` to format the values.<br> Examples: `'#start, #end'`, `['#start', '#end']`, or `[startInput, endInput]` |
|
|
381
|
+
| altFormat | <code>function</code> \| <code>string</code> \| <code>object</code> | | The output format used for `altInput`.<br> Either a string of [Format tokens](https://moment.github.io/luxon/#/formatting?id=table-of-tokens) or [DateTime.toISO()](https://moment.github.io/luxon/api-docs/index.html#datetimetoiso) opts object or a function.<br> Default: `{format: 'extended', precision: <derived from timePickerStepSize>, includeOffset: false}`<br> Examples: `"yyyy:MM:dd'T'HH:mm"`<br> `(date) => date.toUnixInteger()` for singleDatePicker: true or altInput[]<br> `(interval) => interval.toISO('yyyy:MM:dd', {separator: '..'})` for singleDatePicker: false and single altInput |
|
|
382
382
|
| applyButtonClasses | <code>string</code> | <code>"btn-primary"</code> | CSS class names that will be added only to the apply button |
|
|
383
383
|
| cancelButtonClasses | <code>string</code> | <code>"btn-default"</code> | CSS class names that will be added only to the cancel button |
|
|
384
384
|
| buttonClasses | <code>string</code> | | Default: `'btn btn-sm'`<br>CSS class names that will be added to both the apply and cancel buttons. |
|
|
@@ -413,27 +413,33 @@ class DateRangePicker {
|
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
if (
|
|
417
|
-
if (typeof options.altInput === "string") {
|
|
418
|
-
const el = document.querySelector(options.altInput);
|
|
419
|
-
this.altInput = el instanceof HTMLInputElement && el.type === "text" ? el : null;
|
|
420
|
-
} else if (options.altInput instanceof HTMLElement) {
|
|
421
|
-
this.altInput = options.altInput instanceof HTMLInputElement && options.altInput.type === "text" ? options.altInput : null;
|
|
422
|
-
}
|
|
423
|
-
} else if (!this.singleDatePicker && Array.isArray(options.altInput) && options.altInput.length === 2) {
|
|
424
|
-
this.altInput = [];
|
|
425
|
-
for (let item of options.altInput) {
|
|
426
|
-
const el = typeof item === "string" ? document.querySelector(item) : item;
|
|
427
|
-
if (el instanceof HTMLInputElement && el.type === "text")
|
|
428
|
-
this.altInput.push(el);
|
|
429
|
-
}
|
|
430
|
-
if (this.altInput.length !== 2)
|
|
431
|
-
this.altInput = null;
|
|
432
|
-
} else if (options.altInput != null) {
|
|
433
|
-
console.warn(`Option 'altInput' ${JSON.stringify(options.altInput)} is not valid`);
|
|
434
|
-
}
|
|
435
|
-
if (options.altInput && ["function", "string"].includes(typeof options.altFormat))
|
|
416
|
+
if (["function", "string", "object"].includes(typeof options.altFormat))
|
|
436
417
|
this.altFormat = options.altFormat;
|
|
418
|
+
if (typeof options.altInput === "string") {
|
|
419
|
+
if (this.singleDatePicker) {
|
|
420
|
+
const el = document.querySelector(options.altInput);
|
|
421
|
+
if (el instanceof HTMLInputElement && ["text", "hidden"].includes(el.type))
|
|
422
|
+
this.altInput = el;
|
|
423
|
+
} else {
|
|
424
|
+
const el = Array.from(document.querySelectorAll(options.altInput));
|
|
425
|
+
if ([1, 2].includes(el.length) && el.every((x) => x instanceof HTMLInputElement && ["text", "hidden"].includes(x.type)))
|
|
426
|
+
this.altInput = el.length === 1 ? el[0] : el;
|
|
427
|
+
}
|
|
428
|
+
} else if (options.altInput instanceof HTMLElement && ["text", "hidden"].includes(options.altInput.type)) {
|
|
429
|
+
this.altInput = options.altInput;
|
|
430
|
+
} else if (Array.isArray(options.altInput) || options.altInput instanceof HTMLCollection || options.altInput instanceof NodeList) {
|
|
431
|
+
let el = Array.isArray(options.altInput) ? options.altInput : Array.from(options.altInput);
|
|
432
|
+
if (!this.singleDatePicker && el.length === 2) {
|
|
433
|
+
if (el.every((x) => typeof x === "string"))
|
|
434
|
+
el = el.map((x) => {
|
|
435
|
+
return document.querySelector(x);
|
|
436
|
+
});
|
|
437
|
+
if (el.every((x) => x instanceof HTMLInputElement && ["text", "hidden"].includes(x.type)))
|
|
438
|
+
this.altInput = el;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (options.altInput != null && this.altInput == null)
|
|
442
|
+
console.error(`Option 'altInput' ${JSON.stringify(options.altInput)} is not valid`);
|
|
437
443
|
if (typeof options.opens === "string") {
|
|
438
444
|
if (["left", "right", "center"].includes(options.opens))
|
|
439
445
|
this.opens = options.opens;
|
|
@@ -886,7 +892,7 @@ class DateRangePicker {
|
|
|
886
892
|
if (!this.singleDatePicker)
|
|
887
893
|
this.chosenLabel = null;
|
|
888
894
|
if (this.altInput) {
|
|
889
|
-
if (this.singleDatePicker) {
|
|
895
|
+
if (this.singleDatePicker || !Array.isArray(this.altInput)) {
|
|
890
896
|
this.altInput.value = "";
|
|
891
897
|
} else {
|
|
892
898
|
this.altInput[0].value = "";
|
|
@@ -2300,7 +2306,7 @@ class DateRangePicker {
|
|
|
2300
2306
|
updateAltInput() {
|
|
2301
2307
|
if (this.altInput == null)
|
|
2302
2308
|
return;
|
|
2303
|
-
if (this.altFormat == null) {
|
|
2309
|
+
if (this.altFormat == null || typeof this.altFormat === "object") {
|
|
2304
2310
|
let precision = "day";
|
|
2305
2311
|
if (this.timePicker) {
|
|
2306
2312
|
if (this.timePickerOpts.showSeconds) {
|
|
@@ -2311,18 +2317,37 @@ class DateRangePicker {
|
|
|
2311
2317
|
precision = "hour";
|
|
2312
2318
|
}
|
|
2313
2319
|
}
|
|
2314
|
-
const
|
|
2315
|
-
|
|
2316
|
-
if (
|
|
2317
|
-
|
|
2318
|
-
|
|
2320
|
+
const isoOptions = this.altFormat ?? { format: "basic", precision, includeOffset: false };
|
|
2321
|
+
const startDate = this.#startDate.toISO(isoOptions);
|
|
2322
|
+
if (this.singleDatePicker) {
|
|
2323
|
+
this.altInput.value = startDate;
|
|
2324
|
+
} else if (this.#endDate) {
|
|
2325
|
+
const endDate = this.#endDate.toISO(isoOptions);
|
|
2326
|
+
if (Array.isArray(this.altInput)) {
|
|
2327
|
+
this.altInput[0].value = startDate;
|
|
2328
|
+
this.altInput[1].value = endDate;
|
|
2329
|
+
} else {
|
|
2330
|
+
const interval = luxon.Interval.fromDateTimes(this.#startDate, this.#endDate);
|
|
2331
|
+
this.altInput.value = interval.toISO(isoOptions);
|
|
2332
|
+
}
|
|
2319
2333
|
}
|
|
2320
2334
|
} else {
|
|
2321
|
-
const startDate = typeof this.altFormat === "function" ? this.altFormat(this.#startDate) : this.
|
|
2322
|
-
(this.singleDatePicker
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
this.
|
|
2335
|
+
const startDate = typeof this.altFormat === "function" ? this.altFormat(this.#startDate) : this.toFormat(this.#startDate, this.altFormat);
|
|
2336
|
+
if (this.singleDatePicker) {
|
|
2337
|
+
this.altInput.value = startDate;
|
|
2338
|
+
} else if (this.#endDate) {
|
|
2339
|
+
const endDate = typeof this.altFormat === "function" ? this.altFormat(this.#endDate) : this.toFormat(this.#endDate, this.altFormat);
|
|
2340
|
+
if (Array.isArray(this.altInput)) {
|
|
2341
|
+
this.altInput[0].value = startDate;
|
|
2342
|
+
this.altInput[1].value = endDate;
|
|
2343
|
+
} else {
|
|
2344
|
+
const interval = luxon.Interval.fromDateTimes(this.#startDate, this.#endDate);
|
|
2345
|
+
if (typeof this.altFormat === "function") {
|
|
2346
|
+
this.altInput.value = this.altFormat(interval);
|
|
2347
|
+
} else {
|
|
2348
|
+
this.altInput.value = this.toFormat(interval, this.altFormat, { separator: "/" });
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2326
2351
|
}
|
|
2327
2352
|
}
|
|
2328
2353
|
}
|
|
@@ -2384,6 +2409,7 @@ class DateRangePicker {
|
|
|
2384
2409
|
* @param {boolean|object} [options] - Optional event options:
|
|
2385
2410
|
* - `boolean capture`: Whether to listen in the capture phase (default: `false`)
|
|
2386
2411
|
* - `object signal`: An `AbortSignal` for later removal of the listener (default: `undefined`)
|
|
2412
|
+
* @returns {DateRangePicker} - The DateRangePicker instance, usefull for chaining
|
|
2387
2413
|
*
|
|
2388
2414
|
* @example
|
|
2389
2415
|
* picker.addEventListener('hide', (e) => {
|
|
@@ -2393,6 +2419,7 @@ class DateRangePicker {
|
|
|
2393
2419
|
*/
|
|
2394
2420
|
addEventListener(type, listener, options) {
|
|
2395
2421
|
this.element.addEventListener(type, listener, options);
|
|
2422
|
+
return this;
|
|
2396
2423
|
}
|
|
2397
2424
|
/**
|
|
2398
2425
|
* Counterpart to `addEventListener()`
|
|
@@ -2403,9 +2430,11 @@ class DateRangePicker {
|
|
|
2403
2430
|
* @param {boolean|object} [options] - Optional event options:
|
|
2404
2431
|
* - `boolean capture`: Whether to listen in the capture phase (default: `false`)
|
|
2405
2432
|
* - `object signal`: An `AbortSignal` for later removal of the listener (default: `undefined`)
|
|
2406
|
-
|
|
2433
|
+
* @returns {DateRangePicker} - The DateRangePicker instance, usefull for chaining
|
|
2434
|
+
*/
|
|
2407
2435
|
removeEventListener(type, listener, options) {
|
|
2408
2436
|
this.element.removeEventListener(type, listener, options);
|
|
2437
|
+
return this;
|
|
2409
2438
|
}
|
|
2410
2439
|
}
|
|
2411
2440
|
function createElementFromHTML(html) {
|