daterangepicker-4.x 4.9.5 → 4.9.7
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 +2 -2
- package/daterangepicker.js +30 -30
- 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.7/daterangepicker.min.js"></script>
|
|
22
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.9.7/daterangepicker.min.css" rel="stylesheet" />
|
|
23
23
|
|
|
24
24
|
<input type="text" id="daterange" />
|
|
25
25
|
|
package/daterangepicker.js
CHANGED
|
@@ -454,7 +454,7 @@
|
|
|
454
454
|
}
|
|
455
455
|
|
|
456
456
|
for (let opt of ['startDate', 'endDate', 'minDate', 'maxDate', 'initalMonth']) {
|
|
457
|
-
if (opt
|
|
457
|
+
if (opt === 'endDate' && this.singleDatePicker)
|
|
458
458
|
continue;
|
|
459
459
|
if (typeof options[opt] === 'object') {
|
|
460
460
|
if (options[opt] instanceof DateTime && options[opt].isValid) {
|
|
@@ -493,7 +493,7 @@
|
|
|
493
493
|
if (val != '') {
|
|
494
494
|
const split = val.split(this.locale.separator);
|
|
495
495
|
const format = typeof this.locale.format === 'string' ? this.locale.format : DateTime.parseFormatForOpts(this.locale.format);
|
|
496
|
-
if (split.length
|
|
496
|
+
if (split.length === 2) {
|
|
497
497
|
start = DateTime.fromFormat(split[0], format, { locale: DateTime.now().locale });
|
|
498
498
|
end = DateTime.fromFormat(split[1], format, { locale: DateTime.now().locale });
|
|
499
499
|
} else if (this.singleDatePicker) {
|
|
@@ -526,7 +526,7 @@
|
|
|
526
526
|
if (['object', 'string'].includes(typeof options.altInput) && options.altInput != null) {
|
|
527
527
|
if (this.singleDatePicker && typeof options.altInput === 'string') {
|
|
528
528
|
this.altInput = options.altInput
|
|
529
|
-
} else if (!this.singleDatePicker && Array.isArray(options.altInput) && options.altInput.length
|
|
529
|
+
} else if (!this.singleDatePicker && Array.isArray(options.altInput) && options.altInput.length === 2) {
|
|
530
530
|
this.altInput = options.altInput;
|
|
531
531
|
}
|
|
532
532
|
}
|
|
@@ -979,7 +979,7 @@
|
|
|
979
979
|
}
|
|
980
980
|
}
|
|
981
981
|
|
|
982
|
-
if (result.startDate.modified.length
|
|
982
|
+
if (result.startDate.modified.length === 0)
|
|
983
983
|
delete result.startDate.modified;
|
|
984
984
|
|
|
985
985
|
if (this.singleDatePicker) {
|
|
@@ -1091,7 +1091,7 @@
|
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
1093
|
|
|
1094
|
-
if (result.endDate.modified.length
|
|
1094
|
+
if (result.endDate.modified.length === 0)
|
|
1095
1095
|
delete result.endDate.modified;
|
|
1096
1096
|
|
|
1097
1097
|
if (range === undefined) {
|
|
@@ -1264,13 +1264,13 @@
|
|
|
1264
1264
|
* @private
|
|
1265
1265
|
*/
|
|
1266
1266
|
renderCalendar: function (side) {
|
|
1267
|
-
if (side
|
|
1267
|
+
if (side === 'right' && this.singleMonthView)
|
|
1268
1268
|
return;
|
|
1269
1269
|
|
|
1270
1270
|
//
|
|
1271
1271
|
// Build the matrix of dates that will populate the calendar
|
|
1272
1272
|
//
|
|
1273
|
-
var calendar = side
|
|
1273
|
+
var calendar = side === 'left' ? this.leftCalendar : this.rightCalendar;
|
|
1274
1274
|
if (calendar.month == null && !this.startDate && this.initalMonth)
|
|
1275
1275
|
calendar.month = this.initalMonth.startOf('month');
|
|
1276
1276
|
|
|
@@ -1298,7 +1298,7 @@
|
|
|
1298
1298
|
}
|
|
1299
1299
|
|
|
1300
1300
|
//make the calendar object available to hoverDate/clickDate
|
|
1301
|
-
if (side
|
|
1301
|
+
if (side === 'left') {
|
|
1302
1302
|
this.leftCalendar.calendar = calendar;
|
|
1303
1303
|
} else {
|
|
1304
1304
|
this.rightCalendar.calendar = calendar;
|
|
@@ -1308,10 +1308,10 @@
|
|
|
1308
1308
|
// Display the calendar
|
|
1309
1309
|
//
|
|
1310
1310
|
|
|
1311
|
-
var minDate = side
|
|
1311
|
+
var minDate = side === 'left' ? this.minDate : this.startDate;
|
|
1312
1312
|
var maxDate = this.maxDate;
|
|
1313
|
-
var selected = side
|
|
1314
|
-
var arrow = this.locale.direction
|
|
1313
|
+
var selected = side === 'left' ? this.startDate : this.endDate;
|
|
1314
|
+
var arrow = this.locale.direction === 'ltr' ? { left: 'chevron-left', right: 'chevron-right' } : { left: 'chevron-right', right: 'chevron-left' };
|
|
1315
1315
|
|
|
1316
1316
|
var html = '<table class="table-condensed">';
|
|
1317
1317
|
html += '<thead>';
|
|
@@ -1321,7 +1321,7 @@
|
|
|
1321
1321
|
if (this.showWeekNumbers || this.showISOWeekNumbers)
|
|
1322
1322
|
html += '<th></th>';
|
|
1323
1323
|
|
|
1324
|
-
if ((!minDate || minDate < calendar.firstDay) && (!this.linkedCalendars || side
|
|
1324
|
+
if ((!minDate || minDate < calendar.firstDay) && (!this.linkedCalendars || side === 'left')) {
|
|
1325
1325
|
html += '<th class="prev available"><span></span></th>';
|
|
1326
1326
|
} else {
|
|
1327
1327
|
html += '<th></th>';
|
|
@@ -1351,7 +1351,7 @@
|
|
|
1351
1351
|
}
|
|
1352
1352
|
|
|
1353
1353
|
html += '<th colspan="5" class="month">' + dateHtml + '</th>';
|
|
1354
|
-
if ((!maxDate || maxDate > calendar.lastDay.endOf('day')) && (!this.linkedCalendars || side
|
|
1354
|
+
if ((!maxDate || maxDate > calendar.lastDay.endOf('day')) && (!this.linkedCalendars || side === 'right' || this.singleDatePicker || this.singleMonthView)) {
|
|
1355
1355
|
html += '<th class="next available"><span></span></th>';
|
|
1356
1356
|
} else {
|
|
1357
1357
|
html += '<th></th>';
|
|
@@ -1484,7 +1484,7 @@
|
|
|
1484
1484
|
|
|
1485
1485
|
// Don't bother updating the time picker if it's currently disabled
|
|
1486
1486
|
// because an end date hasn't been clicked yet
|
|
1487
|
-
if (side
|
|
1487
|
+
if (side === 'end' && !this.endDate) return;
|
|
1488
1488
|
|
|
1489
1489
|
var selected, minLimit, minDate, maxDate = this.maxDate;
|
|
1490
1490
|
let html = '';
|
|
@@ -1492,13 +1492,13 @@
|
|
|
1492
1492
|
if (this.maxSpan && (!this.maxDate || this.startDate.plus(this.maxSpan) < this.maxDate))
|
|
1493
1493
|
maxDate = this.startDate.plus(this.maxSpan);
|
|
1494
1494
|
|
|
1495
|
-
if (this.minSpan && side
|
|
1495
|
+
if (this.minSpan && side === 'end')
|
|
1496
1496
|
minLimit = this.startDate.plus(this.minSpan);
|
|
1497
1497
|
|
|
1498
|
-
if (side
|
|
1498
|
+
if (side === 'start') {
|
|
1499
1499
|
selected = this.startDate;
|
|
1500
1500
|
minDate = this.minDate;
|
|
1501
|
-
} else if (side
|
|
1501
|
+
} else if (side === 'end') {
|
|
1502
1502
|
selected = this.endDate;
|
|
1503
1503
|
minDate = this.startDate;
|
|
1504
1504
|
|
|
@@ -1524,13 +1524,13 @@
|
|
|
1524
1524
|
//
|
|
1525
1525
|
|
|
1526
1526
|
//if (this.singleMonthView) // to do: localization options
|
|
1527
|
-
// html = `<span style="font-family: arial; font-size: 12px;">${side
|
|
1527
|
+
// html = `<span style="font-family: arial; font-size: 12px;">${side === 'start' ? 'Start' : 'End'}: </span>`;
|
|
1528
1528
|
|
|
1529
1529
|
html += '<select class="hourselect">';
|
|
1530
1530
|
const ampm = selected.toFormat('a', { locale: 'en-US' });
|
|
1531
1531
|
let start = 0;
|
|
1532
1532
|
if (!this.timePicker24Hour)
|
|
1533
|
-
start = ampm
|
|
1533
|
+
start = ampm === 'AM' ? 1 : 13;
|
|
1534
1534
|
|
|
1535
1535
|
for (var i = start; i <= start + 23; i += this.timePickerOpts.hourStep) {
|
|
1536
1536
|
let time = selected.set({ hour: i % 24 });
|
|
@@ -1659,7 +1659,7 @@
|
|
|
1659
1659
|
pm_html = ' disabled="disabled" class="disabled"';
|
|
1660
1660
|
} else {
|
|
1661
1661
|
if (this.isInvalidTime(selected, this.singleDatePicker ? null : side, 'ampm')) {
|
|
1662
|
-
if (selected.toFormat('a', { locale: 'en-US' })
|
|
1662
|
+
if (selected.toFormat('a', { locale: 'en-US' }) === 'AM') {
|
|
1663
1663
|
pm_html = ' disabled="disabled" class="disabled"';
|
|
1664
1664
|
} else {
|
|
1665
1665
|
am_html = ' disabled="disabled" class="disabled"';
|
|
@@ -1668,10 +1668,10 @@
|
|
|
1668
1668
|
}
|
|
1669
1669
|
|
|
1670
1670
|
html += `<option value="AM"${am_html}`;
|
|
1671
|
-
if (selected.toFormat('a', { locale: 'en-US' })
|
|
1671
|
+
if (selected.toFormat('a', { locale: 'en-US' }) === 'AM')
|
|
1672
1672
|
html += ' selected="selected"';
|
|
1673
1673
|
html += `>${Info.meridiems()[0]}</option><option value="PM"${pm_html}`;
|
|
1674
|
-
if (selected.toFormat('a', { locale: 'en-US' })
|
|
1674
|
+
if (selected.toFormat('a', { locale: 'en-US' }) === 'PM')
|
|
1675
1675
|
html += ' selected="selected"';
|
|
1676
1676
|
html += `>${Info.meridiems()[1]}</option>`;
|
|
1677
1677
|
|
|
@@ -1737,9 +1737,9 @@
|
|
|
1737
1737
|
});
|
|
1738
1738
|
var containerWidth = this.container.outerWidth();
|
|
1739
1739
|
|
|
1740
|
-
this.container.toggleClass('drop-up', drops
|
|
1740
|
+
this.container.toggleClass('drop-up', drops === 'up');
|
|
1741
1741
|
|
|
1742
|
-
if (this.opens
|
|
1742
|
+
if (this.opens === 'left') {
|
|
1743
1743
|
var containerRight = parentRightEdge - this.element.offset().left - this.element.outerWidth();
|
|
1744
1744
|
if (containerWidth + containerRight > $(window).width()) {
|
|
1745
1745
|
this.container.css({
|
|
@@ -1754,7 +1754,7 @@
|
|
|
1754
1754
|
left: 'auto'
|
|
1755
1755
|
});
|
|
1756
1756
|
}
|
|
1757
|
-
} else if (this.opens
|
|
1757
|
+
} else if (this.opens === 'center') {
|
|
1758
1758
|
var containerLeft = this.element.offset().left - parentOffset.left + this.element.outerWidth() / 2 - containerWidth / 2;
|
|
1759
1759
|
if (containerLeft < 0) {
|
|
1760
1760
|
this.container.css({
|
|
@@ -1905,13 +1905,13 @@
|
|
|
1905
1905
|
// itself then call this.hide()
|
|
1906
1906
|
if (
|
|
1907
1907
|
// ie modal dialog fix
|
|
1908
|
-
e.type
|
|
1908
|
+
e.type === "focusin" ||
|
|
1909
1909
|
target.closest(this.element).length ||
|
|
1910
1910
|
target.closest(this.container).length ||
|
|
1911
1911
|
target.closest('.calendar-table').length
|
|
1912
1912
|
) return;
|
|
1913
1913
|
|
|
1914
|
-
if (this.onOutsideClick
|
|
1914
|
+
if (this.onOutsideClick === 'cancel') {
|
|
1915
1915
|
this.startDate = this.oldStartDate;
|
|
1916
1916
|
this.endDate = this.oldEndDate;
|
|
1917
1917
|
}
|
|
@@ -2245,7 +2245,7 @@
|
|
|
2245
2245
|
unit = 'second';
|
|
2246
2246
|
}
|
|
2247
2247
|
}
|
|
2248
|
-
if (this.startDate.startOf(unit)
|
|
2248
|
+
if (this.startDate.startOf(unit).equals(this.ranges[range][0].startOf(unit)) && this.endDate.startOf(unit).equals(this.ranges[range][1].startOf(unit))) {
|
|
2249
2249
|
customRange = false;
|
|
2250
2250
|
this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').attr('data-range-key');
|
|
2251
2251
|
break;
|
|
@@ -2338,7 +2338,7 @@
|
|
|
2338
2338
|
if (this.linkedCalendars)
|
|
2339
2339
|
this.rightCalendar.month = this.leftCalendar.month.plus({ month: 1 });
|
|
2340
2340
|
} else {
|
|
2341
|
-
this.
|
|
2341
|
+
this.rightCalendar.month = this.rightCalendar.month.set({ year: year, month: month });
|
|
2342
2342
|
if (this.linkedCalendars)
|
|
2343
2343
|
this.leftCalendar.month = this.rightCalendar.month.minus({ month: 1 });
|
|
2344
2344
|
}
|
|
@@ -2387,7 +2387,7 @@
|
|
|
2387
2387
|
second = parseInt(time.find('.secondselect option:last').val(), 10);
|
|
2388
2388
|
}
|
|
2389
2389
|
|
|
2390
|
-
if (side
|
|
2390
|
+
if (side === 'start') {
|
|
2391
2391
|
if (this.startDate) {
|
|
2392
2392
|
let start = this.startDate.set({ hour: hour, minute: minute, second: second });
|
|
2393
2393
|
this.setStartDate(start, true);
|