|
1 | 1 | /**
|
2 |
| -* @version: 2.1.16 |
| 2 | +* @version: 2.1.17 |
3 | 3 | * @author: Dan Grossman http://www.dangrossman.info/
|
4 | 4 | * @copyright: Copyright (c) 2012-2015 Dan Grossman. All rights reserved.
|
5 | 5 | * @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php
|
|
488 | 488 | if (this.dateLimit && this.startDate.clone().add(this.dateLimit).isBefore(this.endDate))
|
489 | 489 | this.endDate = this.startDate.clone().add(this.dateLimit);
|
490 | 490 |
|
| 491 | + this.previousRightTime = this.endDate.clone(); |
| 492 | + |
491 | 493 | if (!this.isShowing)
|
492 | 494 | this.updateElement();
|
493 | 495 |
|
|
844 | 846 | selected = this.startDate.clone();
|
845 | 847 | minDate = this.minDate;
|
846 | 848 | } else if (side == 'right') {
|
847 |
| - selected = this.endDate ? this.endDate.clone() : this.startDate.clone(); |
| 849 | + selected = this.endDate ? this.endDate.clone() : this.previousRightTime.clone(); |
848 | 850 | minDate = this.startDate;
|
849 | 851 |
|
850 | 852 | //Preserve the time already selected
|
|
1086 | 1088 |
|
1087 | 1089 | this.oldStartDate = this.startDate.clone();
|
1088 | 1090 | this.oldEndDate = this.endDate.clone();
|
| 1091 | + this.previousRightTime = this.endDate.clone(); |
1089 | 1092 |
|
1090 | 1093 | this.updateView();
|
1091 | 1094 | this.container.show();
|
|
1278 | 1281 | // * if single date picker mode, and time picker isn't enabled, apply the selection immediately
|
1279 | 1282 | //
|
1280 | 1283 |
|
1281 |
| - if (this.endDate || date.isBefore(this.startDate)) { |
| 1284 | + if (this.endDate || date.isBefore(this.startDate, 'day')) { |
1282 | 1285 | if (this.timePicker) {
|
1283 | 1286 | var hour = parseInt(this.container.find('.left .hourselect').val(), 10);
|
1284 | 1287 | if (!this.timePicker24Hour) {
|
|
1294 | 1297 | }
|
1295 | 1298 | this.endDate = null;
|
1296 | 1299 | this.setStartDate(date.clone());
|
| 1300 | + } else if (!this.endDate && date.isBefore(this.startDate)) { |
| 1301 | + //special case: clicking the same date for start/end, |
| 1302 | + //but the time of the end date is before the start date |
| 1303 | + this.setEndDate(this.startDate.clone()); |
1297 | 1304 | } else {
|
1298 | 1305 | if (this.timePicker) {
|
1299 | 1306 | var hour = parseInt(this.container.find('.right .hourselect').val(), 10);
|
|
0 commit comments