daterangepicker-4.x 4.8.3 → 4.9.1

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.8.3/daterangepicker.min.js"></script>
22
- <link type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.8.3/daterangepicker.min.css" rel="stylesheet" />
21
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.9.1/daterangepicker.min.js"></script>
22
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.9.1/daterangepicker.min.css" rel="stylesheet" />
23
23
 
24
24
  <input type="text" id="daterange" />
25
25
 
@@ -230,6 +230,9 @@ use <a href="#event_timeChange.daterangepicker">&quot;timeChange.daterangepicker
230
230
  <dt><a href="#event_timeChange.daterangepicker">"timeChange.daterangepicker" (this, side)</a></dt>
231
231
  <dd><p>Emitted when the time changed. Does not trigger when date is changed</p>
232
232
  </dd>
233
+ <dt><a href="#event_inputChanged.daterangepicker">"inputChanged.daterangepicker" (this)</a></dt>
234
+ <dd><p>Emitted when the date is changed through <code>&lt;input&gt;</code> element. Event is only triggered when date string is valid and date value has changed</p>
235
+ </dd>
233
236
  </dl>
234
237
 
235
238
  ## Typedefs
@@ -574,6 +577,17 @@ Emitted when the time changed. Does not trigger when date is changed
574
577
  | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
575
578
  | side | <code>string</code> | Either `'start'` or `'end'` indicating whether startDate or endDate was changed |
576
579
 
580
+ <a name="event_inputChanged.daterangepicker"></a>
581
+
582
+ ## "inputChanged.daterangepicker" (this)
583
+ Emitted when the date is changed through `<input>` element. Event is only triggered when date string is valid and date value has changed
584
+
585
+ **Kind**: event emitted
586
+
587
+ | Param | Type | Description |
588
+ | --- | --- | --- |
589
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
590
+
577
591
  <a name="Options"></a>
578
592
 
579
593
  ## Options
@@ -613,6 +627,7 @@ Options for DateRangePicker
613
627
  | 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)` |
614
628
  | altInput | <code>string</code> \| <code>Array</code> | <code>null</code> | A [jQuery selector](https://api.jquery.com/category/selectors/) string for an alternative ouput (typically hidden) `<input>` element. Requires `altFormat` to be set.<br/> Must be a single string for `singleDatePicker: true` or an array of two strings for `singleDatePicker: false`<br/> Example: `['#start', '#end']` |
615
629
  | altFormat | <code>function</code> \| <code>string</code> | <code></code> | The output format used for `altInput`.<br/> Either a string used with [toFormat()](https://moment.github.io/luxon/api-docs/index.html#datetimetoformat) or a function.<br/> Examples: `'yyyyMMddHHmm'`, `(date) => date.toUnixInteger()` |
630
+ | warnings | <code>boolean</code> | <code>true</code> | When enabled, then warning are printed to console if input date violates `minDate`, `maxDate`, `minSpan`, `maxSpan`, `timePickerStepSize`, 'isInvalidDate', 'isInvalidTime' |
616
631
  | applyButtonClasses | <code>string</code> | <code>&quot;btn-primary&quot;</code> | CSS class names that will be added only to the apply button |
617
632
  | cancelButtonClasses | <code>string</code> | <code>&quot;btn-default&quot;</code> | CSS class names that will be added only to the cancel button |
618
633
  | buttonClasses | <code>string</code> | | Default: `'btn btn-sm'`<br/>CSS class names that will be added to both the apply and cancel buttons. |
@@ -119,6 +119,8 @@
119
119
  * @property {function|string} altFormat=null - The output format used for `altInput`.<br/>
120
120
  * Either a string used with {@link https://moment.github.io/luxon/api-docs/index.html#datetimetoformat|toFormat()} or a function.<br/>
121
121
  * Examples: `'yyyyMMddHHmm'`, `(date) => date.toUnixInteger()`
122
+ * @property {boolean} warnings=true - When enabled, then warning are printed to console if input date violates
123
+ * `minDate`, `maxDate`, `minSpan`, `maxSpan`, `timePickerStepSize`, 'isInvalidDate', 'isInvalidTime'
122
124
 
123
125
  * @property {string} applyButtonClasses=btn-primary - CSS class names that will be added only to the apply button
124
126
  * @property {string} cancelButtonClasses=btn-default - CSS class names that will be added only to the cancel button
@@ -2426,6 +2428,7 @@
2426
2428
  * Update the picker with value from attached `<input>` element.
2427
2429
  * Error is written to console if input string cannot be parsed as a valid date/range
2428
2430
  * @param {external:jQuery} e - The Event target
2431
+ * @emits "inputChanged.daterangepicker"
2429
2432
  * @private
2430
2433
  */
2431
2434
  elementChanged: function (e) {
@@ -2447,13 +2450,23 @@
2447
2450
  }
2448
2451
 
2449
2452
  if (!start.isValid || !end.isValid) {
2450
- console.error(`Input string '${dateString}' is not valid`);
2453
+ // Does not make much sense, because error would be printed on each character
2454
+ //console.error(`Input string '${dateString}' is not valid`);
2451
2455
  return;
2452
2456
  }
2457
+ const trigger = this.startDate != start || (!this.singleDatePicker && this.endDate != end);
2453
2458
 
2454
2459
  this.setStartDate(start, false);
2455
2460
  this.setEndDate(end, false);
2456
2461
  this.updateView();
2462
+ /**
2463
+ * Emitted when the date is changed through `<input>` element. Event is only triggered when date string is valid and date value has changed
2464
+ * @event
2465
+ * @name "inputChanged.daterangepicker"
2466
+ * @param {DateRangePicker} this - The daterangepicker object
2467
+ */
2468
+ if (trigger)
2469
+ this.element.trigger('inputChanged.daterangepicker', this);
2457
2470
  },
2458
2471
 
2459
2472
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "daterangepicker-4.x",
3
- "version": "4.8.3",
3
+ "version": "4.9.1",
4
4
  "description": "Date range picker with time component and pre-defined ranges",
5
5
  "main": "daterangepicker.js",
6
6
  "style": "daterangepicker.css",