daterangepicker-4.x 4.9.0 → 4.9.2
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 +5 -4
- package/daterangepicker.js +24 -21
- package/package.json +1 -1
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.9.
|
|
22
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.9.
|
|
21
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.9.2/daterangepicker.min.js"></script>
|
|
22
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.9.2/daterangepicker.min.css" rel="stylesheet" />
|
|
23
23
|
|
|
24
24
|
<input type="text" id="daterange" />
|
|
25
25
|
|
|
@@ -231,7 +231,7 @@ use <a href="#event_timeChange.daterangepicker">"timeChange.daterangepicker
|
|
|
231
231
|
<dd><p>Emitted when the time changed. Does not trigger when date is changed</p>
|
|
232
232
|
</dd>
|
|
233
233
|
<dt><a href="#event_inputChanged.daterangepicker">"inputChanged.daterangepicker" (this)</a></dt>
|
|
234
|
-
<dd><p>Emitted when the date is changed through <code><input></code> element. Event is only triggered when date string is valid date value
|
|
234
|
+
<dd><p>Emitted when the date is changed through <code><input></code> element. Event is only triggered when date string is valid and date value has changed</p>
|
|
235
235
|
</dd>
|
|
236
236
|
</dl>
|
|
237
237
|
|
|
@@ -580,7 +580,7 @@ Emitted when the time changed. Does not trigger when date is changed
|
|
|
580
580
|
<a name="event_inputChanged.daterangepicker"></a>
|
|
581
581
|
|
|
582
582
|
## "inputChanged.daterangepicker" (this)
|
|
583
|
-
Emitted when the date is changed through `<input>` element. Event is only triggered when date string is valid date value
|
|
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
584
|
|
|
585
585
|
**Kind**: event emitted
|
|
586
586
|
|
|
@@ -627,6 +627,7 @@ Options for DateRangePicker
|
|
|
627
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)` |
|
|
628
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']` |
|
|
629
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' |
|
|
630
631
|
| applyButtonClasses | <code>string</code> | <code>"btn-primary"</code> | CSS class names that will be added only to the apply button |
|
|
631
632
|
| cancelButtonClasses | <code>string</code> | <code>"btn-default"</code> | CSS class names that will be added only to the cancel button |
|
|
632
633
|
| buttonClasses | <code>string</code> | | Default: `'btn btn-sm'`<br/>CSS class names that will be added to both the apply and cancel buttons. |
|
package/daterangepicker.js
CHANGED
|
@@ -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
|
|
@@ -668,32 +670,32 @@
|
|
|
668
670
|
//
|
|
669
671
|
|
|
670
672
|
this.container.find('.drp-calendar')
|
|
671
|
-
.on('click.daterangepicker', '.prev',
|
|
672
|
-
.on('click.daterangepicker', '.next',
|
|
673
|
-
.on('mousedown.daterangepicker', 'td.available',
|
|
674
|
-
.on('mouseenter.daterangepicker', 'td.available',
|
|
675
|
-
.on('change.daterangepicker', 'select.yearselect',
|
|
676
|
-
.on('change.daterangepicker', 'select.monthselect',
|
|
677
|
-
.on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect',
|
|
673
|
+
.on('click.daterangepicker', '.prev', this.clickPrev.bind(this))
|
|
674
|
+
.on('click.daterangepicker', '.next', this.clickNext.bind(this))
|
|
675
|
+
.on('mousedown.daterangepicker', 'td.available', this.clickDate.bind(this))
|
|
676
|
+
.on('mouseenter.daterangepicker', 'td.available', this.hoverDate.bind(this))
|
|
677
|
+
.on('change.daterangepicker', 'select.yearselect', this.monthOrYearChanged.bind(this))
|
|
678
|
+
.on('change.daterangepicker', 'select.monthselect', this.monthOrYearChanged.bind(this))
|
|
679
|
+
.on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect', this.timeChanged.bind(this));
|
|
678
680
|
|
|
679
681
|
this.container.find('.ranges')
|
|
680
|
-
.on('click.daterangepicker', 'li',
|
|
681
|
-
.on('mouseenter.daterangepicker', 'li',
|
|
682
|
+
.on('click.daterangepicker', 'li', this.clickRange.bind(this))
|
|
683
|
+
.on('mouseenter.daterangepicker', 'li', this.hoverRange.bind(this));
|
|
682
684
|
|
|
683
685
|
this.container.find('.drp-buttons')
|
|
684
|
-
.on('click.daterangepicker', 'button.applyBtn',
|
|
685
|
-
.on('click.daterangepicker', 'button.cancelBtn',
|
|
686
|
+
.on('click.daterangepicker', 'button.applyBtn', this.clickApply.bind(this))
|
|
687
|
+
.on('click.daterangepicker', 'button.cancelBtn', this.clickCancel.bind(this));
|
|
686
688
|
|
|
687
689
|
if (this.element.is('input') || this.element.is('button')) {
|
|
688
690
|
this.element.on({
|
|
689
|
-
'click.daterangepicker':
|
|
690
|
-
'focus.daterangepicker':
|
|
691
|
-
'keyup.daterangepicker':
|
|
692
|
-
'keydown.daterangepicker':
|
|
691
|
+
'click.daterangepicker': this.show.bind(this),
|
|
692
|
+
'focus.daterangepicker': this.show.bind(this),
|
|
693
|
+
'keyup.daterangepicker': this.elementChanged.bind(this),
|
|
694
|
+
'keydown.daterangepicker': this.keydown.bind(this) //IE 11 compatibility
|
|
693
695
|
});
|
|
694
696
|
} else {
|
|
695
|
-
this.element.on('click.daterangepicker',
|
|
696
|
-
this.element.on('keydown.daterangepicker',
|
|
697
|
+
this.element.on('click.daterangepicker', this.toggle.bind(this));
|
|
698
|
+
this.element.on('keydown.daterangepicker', this.toggle.bind(this));
|
|
697
699
|
}
|
|
698
700
|
|
|
699
701
|
//
|
|
@@ -1799,7 +1801,7 @@
|
|
|
1799
1801
|
if (this.isShowing) return;
|
|
1800
1802
|
|
|
1801
1803
|
// Create a click proxy that is private to this instance of datepicker, for unbinding
|
|
1802
|
-
this._outsideClickProxy =
|
|
1804
|
+
this._outsideClickProxy = function (e) { this.outsideClick(e); }.bind(this);
|
|
1803
1805
|
|
|
1804
1806
|
// Bind global datepicker mousedown for hiding and
|
|
1805
1807
|
$(document)
|
|
@@ -1812,7 +1814,7 @@
|
|
|
1812
1814
|
.on('focusin.daterangepicker', this._outsideClickProxy);
|
|
1813
1815
|
|
|
1814
1816
|
// Reposition the picker if the window is resized while it's open
|
|
1815
|
-
$(window).on('resize.daterangepicker',
|
|
1817
|
+
$(window).on('resize.daterangepicker', function (e) { this.move(e); }.bind(this));
|
|
1816
1818
|
|
|
1817
1819
|
this.oldStartDate = this.startDate;
|
|
1818
1820
|
this.oldEndDate = this.endDate;
|
|
@@ -2448,7 +2450,8 @@
|
|
|
2448
2450
|
}
|
|
2449
2451
|
|
|
2450
2452
|
if (!start.isValid || !end.isValid) {
|
|
2451
|
-
|
|
2453
|
+
// Does not make much sense, because error would be printed on each character
|
|
2454
|
+
//console.error(`Input string '${dateString}' is not valid`);
|
|
2452
2455
|
return;
|
|
2453
2456
|
}
|
|
2454
2457
|
const trigger = this.startDate != start || (!this.singleDatePicker && this.endDate != end);
|
|
@@ -2457,7 +2460,7 @@
|
|
|
2457
2460
|
this.setEndDate(end, false);
|
|
2458
2461
|
this.updateView();
|
|
2459
2462
|
/**
|
|
2460
|
-
* Emitted when the date is changed through `<input>` element. Event is only triggered when date string is valid date value
|
|
2463
|
+
* Emitted when the date is changed through `<input>` element. Event is only triggered when date string is valid and date value has changed
|
|
2461
2464
|
* @event
|
|
2462
2465
|
* @name "inputChanged.daterangepicker"
|
|
2463
2466
|
* @param {DateRangePicker} this - The daterangepicker object
|