daterangepicker-4.x 4.2.2 → 4.2.4

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 CHANGED
@@ -18,8 +18,8 @@ Above samples are based on the [original repository](https://github.com/dangross
18
18
  ```html
19
19
  <script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
20
20
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
21
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.2.2/daterangepicker.min.js"></script>
22
- <link type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.2.2/daterangepicker.min.css" rel="stylesheet" />
21
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.2.4/daterangepicker.min.js"></script>
22
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.2.4/daterangepicker.min.css" rel="stylesheet" />
23
23
 
24
24
  <input type="text" id="daterange" />
25
25
 
@@ -107,6 +107,17 @@ In original daterangepicker this parameter defines whether the `<input>` is upda
107
107
  - Added option `locale.durationFormat` to show customized label for selected duration, e.g. `'4 Days, 6 Hours, 30 Minutes'`
108
108
  - ... and maybe some new bugs 😉
109
109
 
110
+ ## Methods
111
+
112
+ Available methods are listed below in [API documentation](#DateRangePicker). You will mainly use
113
+ * [.daterangepicker(options, callback)](#DateRangePicker.daterangepicker)
114
+ * [.setStartDate(startDate)](#DateRangePicker+setStartDate)
115
+ * [.setEndDate(endDate)](#DateRangePicker+setEndDate)
116
+ * [.setPeriod(startDate, endDate)](#DateRangePicker+setPeriod)
117
+ * `$(...).data('daterangepicker')` to get the daterangepicker object
118
+
119
+ all other methods are used rarely.
120
+
110
121
  ### Differences between `moment` and `luxon` library
111
122
  This table lists a few important differences between datarangepicker using moment and luxon. Check them carefully when you migrate from older daterangepicker.
112
123
 
@@ -154,8 +165,7 @@ Licensed under the [MIT license](LICENSE).
154
165
  </dd>
155
166
  <dt><a href="#event_outsideClick.daterangepicker">"outsideClick.daterangepicker" (this)</a></dt>
156
167
  <dd><p>Emitted when user clicks outside the picker.
157
- Picker values is not updated, you may trigger <a href="#event_apply.daterangepicker">&quot;apply.daterangepicker&quot;</a>
158
- or <a href="#event_cancel.daterangepicker">&quot;cancel.daterangepicker&quot;</a> in your EventHandler.</p>
168
+ Use option <code>onOutsideClick</code> to define the default action, then you may not need to handle this event.</p>
159
169
  </dd>
160
170
  <dt><a href="#event_showCalendar.daterangepicker">"showCalendar.daterangepicker" (this)</a></dt>
161
171
  <dd><p>Emitted when the calendar(s) are shown.
@@ -208,7 +218,10 @@ use <a href="#event_timeChange.daterangepicker">&quot;timeChange.daterangepicker
208
218
  * [.setEndDate(endDate, isValid)](#DateRangePicker+setEndDate)
209
219
  * [.setPeriod(startDate, endDate, isValid)](#DateRangePicker+setPeriod)
210
220
  * [.updateView()](#DateRangePicker+updateView)
211
- * [.outsideClick(e)](#DateRangePicker+outsideClick)
221
+ * [.showCalendars()](#DateRangePicker+showCalendars)
222
+ * [.hideCalendars()](#DateRangePicker+hideCalendars)
223
+ * [.updateElement()](#DateRangePicker+updateElement)
224
+ * [.remove()](#DateRangePicker+remove)
212
225
  * _static_
213
226
  * [.daterangepicker(options, callback)](#DateRangePicker.daterangepicker) ⇒
214
227
 
@@ -218,7 +231,7 @@ use <a href="#event_timeChange.daterangepicker">&quot;timeChange.daterangepicker
218
231
 
219
232
  | Param | Type | Description |
220
233
  | --- | --- | --- |
221
- | element | [<code>jQuery</code>](https://learn.jquery.com/using-jquery-core/jquery-object/) | jQuery selector of the parent element that the date range picker will be added to |
234
+ | element | [<code>jQuery</code>](https://api.jquery.com/Types/#jQuery/) | jQuery selector of the parent element that the date range picker will be added to |
222
235
  | options | [<code>Options</code>](#Options) | Object to configure the DateRangePicker |
223
236
  | cb | <code>function</code> | Callback function executed when |
224
237
 
@@ -308,18 +321,33 @@ Updates the picker when calendar is initiated or any date has been selected.
308
321
  Could be useful after running [setStartDate](#DateRangePicker+setStartDate) or [setEndDate](#DateRangePicker+setEndDate)
309
322
 
310
323
  **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
311
- <a name="DateRangePicker+outsideClick"></a>
324
+ <a name="DateRangePicker+showCalendars"></a>
312
325
 
313
- ### dateRangePicker.outsideClick(e)
314
- Closes the picker when user clicks outside
326
+ ### dateRangePicker.showCalendars()
327
+ Shows calendar when user selects "Custom Ranges"
315
328
 
316
329
  **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
317
- **Emits**: <code>event:&quot;outsideClick.daterangepicker&quot;</code>
330
+ **Emits**: <code>event:&quot;showCalendar.daterangepicker&quot;</code>
331
+ <a name="DateRangePicker+hideCalendars"></a>
318
332
 
319
- | Param | Type | Description |
320
- | --- | --- | --- |
321
- | e | [<code>jQuery</code>](https://learn.jquery.com/using-jquery-core/jquery-object/) | The Event target |
333
+ ### dateRangePicker.hideCalendars()
334
+ Hides calendar when user selects a predefined range
335
+
336
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
337
+ **Emits**: <code>event:&quot;hideCalendar.daterangepicker&quot;</code>
338
+ <a name="DateRangePicker+updateElement"></a>
339
+
340
+ ### dateRangePicker.updateElement()
341
+ Update attached `<input>` element with selected value
342
+
343
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
344
+ **Emits**: [<code>change</code>](https://api.jquery.com/change/)
345
+ <a name="DateRangePicker+remove"></a>
346
+
347
+ ### dateRangePicker.remove()
348
+ Removes the picker from document
322
349
 
350
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
323
351
  <a name="DateRangePicker.daterangepicker"></a>
324
352
 
325
353
  ### DateRangePicker.daterangepicker(options, callback) ⇒
@@ -331,7 +359,7 @@ Initiate a new DateRangePicker
331
359
  | Param | Type | Description |
332
360
  | --- | --- | --- |
333
361
  | options | [<code>Options</code>](#Options) | Object to configure the DateRangePicker |
334
- | callback | [<code>callback</code>](#callback) | Callback function executed when date is changed. As alternative listen to the ["apply.daterangepicker"](#event_apply.daterangepicker) event |
362
+ | callback | [<code>callback</code>](#callback) | Callback function executed when date is changed.<br/> Callback function is executed if selected date values has changed, before picker is hidden and before the attached `<input>` element is updated. As alternative listen to the ["apply.daterangepicker"](#event_apply.daterangepicker) event |
335
363
 
336
364
  <a name="event_show.daterangepicker"></a>
337
365
 
@@ -371,8 +399,7 @@ Emitted when the picker is hidden
371
399
 
372
400
  ## "outsideClick.daterangepicker" (this)
373
401
  Emitted when user clicks outside the picker.
374
- Picker values is not updated, you may trigger ["apply.daterangepicker"](#event_apply.daterangepicker)
375
- or ["cancel.daterangepicker"](#event_cancel.daterangepicker) in your EventHandler.
402
+ Use option `onOutsideClick` to define the default action, then you may not need to handle this event.
376
403
 
377
404
  **Kind**: event emitted
378
405
 
@@ -468,7 +495,7 @@ Options for DateRangePicker
468
495
  | 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](ISO-8601) or a string matching `locale.format`. |
469
496
  | minSpan | [<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](ISO-8601) duration.<br/> Ignored when `singleDatePicker: true` |
470
497
  | maxSpan | [<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](ISO-8601) duration.<br/> Ignored when `singleDatePicker: true` |
471
- | initalMonth | [<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 shown when `startDate: null`. <br/> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](ISO-8601) or a string matching `locale.format`.<br/> When `initalMonth` is used, then `endDate` is ignored and it works only with `timePicker: false` |
498
+ | initalMonth | [<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 shown when `startDate: null`. Be aware, the attached `<input>` element must be also empty.`<br/> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](ISO-8601) or a string matching `locale.format`.<br/> When `initalMonth` is used, then `endDate` is ignored and it works only with `timePicker: false` |
472
499
  | 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` |
473
500
  | 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/> The start and end dates provided to your callback will be the same single date chosen. |
474
501
  | showDropdowns | <code>boolean</code> | <code>false</code> | Show year and month select boxes above calendars to jump to a specific month and year |
@@ -485,7 +512,7 @@ Options for DateRangePicker
485
512
  | onOutsideClick | <code>string</code> | <code>&quot;apply&quot;</code> | Defines what picker shall do when user clicks outside the calendar. `'apply'` or `'cancel'`. Event [onOutsideClick.daterangepicker](#event_outsideClick.daterangepicker) is always emitted. |
486
513
  | linkedCalendars | <code>boolean</code> | <code>true</code> | When enabled, the two calendars displayed will always be for two sequential months (i.e. January and February), and both will be advanced when clicking the left or right arrows above the calendars.<br/> When disabled, the two calendars can be individually advanced and display any month/year |
487
514
  | 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/> Function has no effect on date values set by `startDate`, `endDate`, `ranges`, [setStartDate](#DateRangePicker+setStartDate), [setEndDate](#DateRangePicker+setEndDate). |
488
- | 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: `isInvalidDate(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/> Function has no effect on time values set by `startDate`, `endDate`, `ranges`, [setStartDate](#DateRangePicker+setStartDate), [setEndDate](#DateRangePicker+setEndDate).<br/> Ensure that your function returns `false` for at least one item. Otherwise the calender is not rendered.<br/> |
515
+ | 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/> Function has no effect on time values set by `startDate`, `endDate`, `ranges`, [setStartDate](#DateRangePicker+setStartDate), [setEndDate](#DateRangePicker+setEndDate).<br/> Ensure that your function returns `false` for at least one item. Otherwise the calender is not rendered.<br/> |
489
516
  | 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)` |
490
517
  | applyButtonClasses | <code>string</code> | <code>&quot;btn-primary&quot;</code> | CSS class names that will be added only to the apply button |
491
518
  | cancelButtonClasses | <code>string</code> | <code>&quot;btn-default&quot;</code> | CSS class names that will be added only to the cancel button |
@@ -61,7 +61,7 @@
61
61
  * Must be a `luxon.Duration` or number of seconds or a string according to {@link ISO-8601} duration.<br/>
62
62
  * Ignored when `singleDatePicker: true`
63
63
  * @property {external:DateTime|external:Date|string|null} initalMonth - Default: `DateTime.now().startOf('month')`<br/>
64
- * The inital month shown when `startDate: null`. <br/>
64
+ * The inital month shown when `startDate: null`. Be aware, the attached `<input>` element must be also empty.`<br/>
65
65
  * Must be a `luxon.DateTime` or `Date` or `string` according to {@link ISO-8601} or a string matching `locale.format`.<br/>
66
66
  * When `initalMonth` is used, then `endDate` is ignored and it works only with `timePicker: false`
67
67
 
@@ -100,7 +100,7 @@
100
100
  * Function has no effect on date values set by `startDate`, `endDate`, `ranges`, {@link #DateRangePicker+setStartDate|setStartDate}, {@link #DateRangePicker+setEndDate|setEndDate}.
101
101
  * @property {function} isInvalidTime=false - A function that is passed each hour/minute/second/am-pm in the two calendars before they are displayed,<br/>
102
102
  * and may return `true` or `false` to indicate whether that date should be available for selection or not.<br/>
103
- * Signature: `isInvalidDate(time, side, unit)`<br/>
103
+ * Signature: `isInvalidTime(time, side, unit)`<br/>
104
104
  * `side` is `'start'` or `'end'` or `null` for `singleDatePicker: true`<br/>
105
105
  * `unit` is `'hour'`, `'minute'`, `'second'` or `'ampm'`<br/>
106
106
  * Hours are always given as 24-hour clock<br/>
@@ -435,16 +435,47 @@
435
435
  if (this.maxDate)
436
436
  this.maxDate = this.maxDate.endOf('day');
437
437
  }
438
+
439
+ //if no start/end dates set, check if the input element contains initial values
440
+ if (typeof options.startDate === 'undefined' && typeof options.endDate === 'undefined') {
441
+ if ($(this.element).is(':text')) {
442
+ let start, end;
443
+ const val = $(this.element).val();
444
+ if (val != '') {
445
+ const split = val.split(this.locale.separator);
446
+ const format = typeof this.locale.format === 'string' ? this.locale.format : DateTime.parseFormatForOpts(this.locale.format);
447
+ if (split.length == 2) {
448
+ start = DateTime.fromFormat(split[0], format, { locale: DateTime.now().locale });
449
+ end = DateTime.fromFormat(split[1], format, { locale: DateTime.now().locale });
450
+ } else if (this.singleDatePicker) {
451
+ start = DateTime.fromFormat(val, format, { locale: DateTime.now().locale });
452
+ end = DateTime.fromFormat(val, format, { locale: DateTime.now().locale });
453
+ }
454
+
455
+ if (start.isValid && end.isValid) {
456
+ this.setStartDate(start, false);
457
+ this.setEndDate(end, false);
458
+ } else {
459
+ console.error(`Value in <input> is not a valid string`);
460
+ }
461
+ }
462
+ }
463
+ }
464
+
438
465
  if (this.singleDatePicker) {
439
466
  this.endDate = this.startDate;
440
467
  } else if (this.endDate < this.startDate) {
441
468
  this.endDate = this.startDate;
469
+ console.warn(`Set endDate to ${this.timePicker ? endDate.toISO({ suppressMilliseconds: true }) : endDate.toISODate()} because it was earlier than startDate`);
442
470
  }
443
- if (!this.startDate && this.initalMonth)
444
- this.endDate = null;
445
471
 
446
- // Do some sanity checks on startDate for minDate, maxDate
447
- this.constrainDate();
472
+ if (!this.startDate && this.initalMonth) {
473
+ // No initial date selected
474
+ this.endDate = null;
475
+ } else {
476
+ // Do some sanity checks on startDate for minDate, maxDate
477
+ this.constrainDate();
478
+ }
448
479
 
449
480
  if (typeof options.applyButtonClasses === 'string')
450
481
  this.applyButtonClasses = options.applyButtonClasses;
@@ -533,29 +564,6 @@
533
564
  }
534
565
  }
535
566
 
536
- //if no start/end dates set, check if the input element contains initial values
537
- if (typeof options.startDate === 'undefined' && typeof options.endDate === 'undefined') {
538
- if ($(this.element).is(':text')) {
539
- let start, end;
540
- const val = $(this.element).val();
541
- const split = val.split(this.locale.separator);
542
-
543
- const format = typeof this.locale.format === 'string' ? this.locale.format : DateTime.parseFormatForOpts(this.locale.format);
544
- if (split.length == 2) {
545
- start = DateTime.fromFormat(split[0], format, { locale: DateTime.now().locale });
546
- end = DateTime.fromFormat(split[1], format, { locale: DateTime.now().locale });
547
- } else if (this.singleDatePicker && val !== "") {
548
- start = DateTime.fromFormat(val, format, { locale: DateTime.now().locale });
549
- end = DateTime.fromFormat(val, format, { locale: DateTime.now().locale });
550
- }
551
-
552
- if (start.isValid && end.isValid) {
553
- this.setStartDate(start, false);
554
- this.setEndDate(end, false);
555
- }
556
- }
557
- }
558
-
559
567
  if (!this.singleDatePicker && typeof options.ranges === 'object') {
560
568
  // Process custom ranges
561
569
  for (let range in options.ranges) {
@@ -1046,7 +1054,7 @@
1046
1054
  },
1047
1055
 
1048
1056
  /**
1049
- * Displays the months
1057
+ * Shows calendar months based on selected date values
1050
1058
  * @private
1051
1059
  */
1052
1060
  updateMonthsInView: function () {
@@ -1086,7 +1094,7 @@
1086
1094
  },
1087
1095
 
1088
1096
  /**
1089
- * Updates the custome ranges
1097
+ * Updates the selected day value from calendar with selected time values
1090
1098
  * @private
1091
1099
  */
1092
1100
  updateCalendars: function () {
@@ -1569,7 +1577,7 @@
1569
1577
  },
1570
1578
 
1571
1579
  /**
1572
- * Update the linke `<input>` element with selected date
1580
+ * Disable the `Apply` button if no date value is selected
1573
1581
  * @private
1574
1582
  */
1575
1583
  updateFormInputs: function () {
@@ -1582,7 +1590,7 @@
1582
1590
  },
1583
1591
 
1584
1592
  /**
1585
- * Positions the calendar
1593
+ * Place the picker at the right place in the document
1586
1594
  * @private
1587
1595
  */
1588
1596
  move: function () {
@@ -1784,6 +1792,7 @@
1784
1792
  * Closes the picker when user clicks outside
1785
1793
  * @param {external:jQuery} e - The Event target
1786
1794
  * @emits "outsideClick.daterangepicker"
1795
+ * @private
1787
1796
  */
1788
1797
  outsideClick: function (e) {
1789
1798
  var target = $(e.target);
@@ -1805,8 +1814,7 @@
1805
1814
 
1806
1815
  /**
1807
1816
  * Emitted when user clicks outside the picker.
1808
- * Picker values is not updated, you may trigger {@link #event_apply.daterangepicker|"apply.daterangepicker"}
1809
- * or {@link #event_cancel.daterangepicker|"cancel.daterangepicker"} in your EventHandler.
1817
+ * Use option `onOutsideClick` to define the default action, then you may not need to handle this event.
1810
1818
  * @event
1811
1819
  * @name "outsideClick.daterangepicker"
1812
1820
  * @param {DateRangePicker} this - The daterangepicker object
@@ -1817,7 +1825,6 @@
1817
1825
  /**
1818
1826
  * Shows calendar when user selects "Custom Ranges"
1819
1827
  * @emits "showCalendar.daterangepicker"
1820
- * @private
1821
1828
  */
1822
1829
  showCalendars: function () {
1823
1830
  this.container.addClass('show-calendar');
@@ -1835,7 +1842,6 @@
1835
1842
  /**
1836
1843
  * Hides calendar when user selects a predefined range
1837
1844
  * @emits "hideCalendar.daterangepicker"
1838
- * @private
1839
1845
  */
1840
1846
  hideCalendars: function () {
1841
1847
  this.container.removeClass('show-calendar');
@@ -2114,7 +2120,6 @@
2114
2120
 
2115
2121
  /**
2116
2122
  * Hightlight selected predefined range in calendar
2117
- * @param {external:jQuery} e - The Event target
2118
2123
  * @private
2119
2124
  */
2120
2125
  calculateChosenLabel: function () {
@@ -2310,10 +2315,12 @@
2310
2315
  },
2311
2316
 
2312
2317
  /**
2313
- * User inserted value into `<input>`
2318
+ * Update the picker with value from attached `<input>` element.
2319
+ * Error is written to console if input string cannot be parsed as a valid date/range
2320
+ * @param {external:jQuery} e - The Event target
2314
2321
  * @private
2315
2322
  */
2316
- elementChanged: function () {
2323
+ elementChanged: function (e) {
2317
2324
  if (!this.element.is('input')) return;
2318
2325
  if (!this.element.val().length) return;
2319
2326
 
@@ -2331,7 +2338,10 @@
2331
2338
  end = start;
2332
2339
  }
2333
2340
 
2334
- if (!start.isValid || !end.isValid) return;
2341
+ if (!start.isValid || !end.isValid) {
2342
+ console.error(`Input string '${dateString}' is not valid`);
2343
+ return;
2344
+ }
2335
2345
 
2336
2346
  this.setStartDate(start, false);
2337
2347
  this.setEndDate(end, false);
@@ -2339,7 +2349,7 @@
2339
2349
  },
2340
2350
 
2341
2351
  /**
2342
- * Handles key press
2352
+ * Handles key press, IE 11 compatibility
2343
2353
  * @param {external:jQuery} e - The Event target
2344
2354
  * @private
2345
2355
  */
@@ -2359,8 +2369,8 @@
2359
2369
  },
2360
2370
 
2361
2371
  /**
2362
- * Update linked `<input>` element with selected value
2363
- * @private
2372
+ * Update attached `<input>` element with selected value
2373
+ * @emits external:change
2364
2374
  */
2365
2375
  updateElement: function () {
2366
2376
  if (this.startDate == null && this.initalMonth)
@@ -2379,8 +2389,7 @@
2379
2389
  },
2380
2390
 
2381
2391
  /**
2382
- * Remove the picker from document
2383
- * @private
2392
+ * Removes the picker from document
2384
2393
  */
2385
2394
  remove: function () {
2386
2395
  this.container.remove();
@@ -2402,8 +2411,9 @@
2402
2411
  * @name DateRangePicker.daterangepicker
2403
2412
  * @function
2404
2413
  * @param {Options} options - Object to configure the DateRangePicker
2405
- * @param {callback} callback - Callback function executed when date is changed.
2406
- * As alternative listen to the {@link #event_apply.daterangepicker|"apply.daterangepicker"} event
2414
+ * @param {callback} callback - Callback function executed when date is changed.<br/>
2415
+ * Callback function is executed if selected date values has changed, before picker is hidden and before the attached `<input>` element is updated.
2416
+ * As alternative listen to the {@link #event_apply.daterangepicker|"apply.daterangepicker"} event
2407
2417
  * @returns DateRangePicker
2408
2418
  */
2409
2419
  $.fn.daterangepicker = function (options, callback) {
@@ -2423,10 +2433,13 @@
2423
2433
 
2424
2434
 
2425
2435
  /** @external jQuery
2426
- @see {@link https://learn.jquery.com/using-jquery-core/jquery-object/|jQuery} */
2436
+ @see {@link https://api.jquery.com/Types/#jQuery/|jQuery} */
2427
2437
 
2428
2438
  /** @external Selector
2429
- @see {@link https://learn.jquery.com/using-jquery-core/jquery-object/|jQuery Selector} */
2439
+ @see {@link https://api.jquery.com/category/selectors/|jQuery Selector} */
2440
+
2441
+ /** @external change
2442
+ @see {@link https://api.jquery.com/change/|change event} */
2430
2443
 
2431
2444
  /** @external DateTime
2432
2445
  @see {@link https://moment.github.io/luxon/api-docs/index.html#datetime|DateTime} */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "daterangepicker-4.x",
3
- "version": "4.2.2",
3
+ "version": "4.2.4",
4
4
  "description": "Date range picker with time component and pre-defined ranges",
5
5
  "main": "daterangepicker.js",
6
6
  "style": "daterangepicker.css",