Skip to content

Commit 41c4717

Browse files
committed
Update to release v1.6.6
1 parent c6cb19d commit 41c4717

12 files changed

+77
-25
lines changed

CHANGE.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Change Log: `yii2-date-range`
22
=============================
33

4+
## Version 1.6.6
5+
6+
**Date:** 11-Jan-2016
7+
8+
- (enh #55): Enhancements for PJAX based reinitialization. Complements enhancements in kartik-v/yii2-krajee-base#52 and kartik-v/yii2-krajee-base#53.
9+
- (enh #56): Update to latest version of bootstrap-daterangepicker.
10+
411
## Version 1.6.5
512

613
**Date:** 22-Oct-2015

DateRangePicker.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

33
/**
4-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015
4+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2016
55
* @package yii2-date-range
6-
* @version 1.6.5
6+
* @version 1.6.6
77
*/
88

99
namespace kartik\daterange;
@@ -96,9 +96,9 @@ class DateRangePicker extends InputWidget
9696
public $options = ['class' => 'form-control'];
9797

9898
/**
99-
* @inherit doc
99+
* @inheritdoc
100100
*/
101-
protected $_pluginName = 'daterangepicker';
101+
public $pluginName = 'daterangepicker';
102102

103103
/**
104104
* @var string locale language to be used for the plugin
@@ -323,12 +323,12 @@ public function registerAssets()
323323
} elseif (!$this->autoUpdateOnInit) {
324324
$script = "var val={$val};{$change}";
325325
} else {
326-
$this->registerPlugin($this->_pluginName, $id);
326+
$this->registerPlugin($this->pluginName, $id);
327327
return;
328328
}
329329
$this->callback = "function(start,end,label){{$script}}";
330330
}
331-
$this->registerPlugin($this->_pluginName, $id, null, $this->callback);
331+
$this->registerPlugin($this->pluginName, $id, null, $this->callback);
332332
}
333333

334334
/**

DateRangePickerAsset.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

33
/**
4-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015
4+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2016
55
* @package yii2-date-range
6-
* @version 1.6.5
6+
* @version 1.6.6
77
*/
88

99
namespace kartik\daterange;

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2015, Kartik Visweswaran
1+
Copyright (c) 2015 - 2016, Kartik Visweswaran
22
Krajee.com
33
All rights reserved.
44

LanguageAsset.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

33
/**
4-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015
4+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2016
55
* @package yii2-date-range
6-
* @version 1.6.5
6+
* @version 1.6.6
77
*/
88

99
namespace kartik\daterange;

MomentAsset.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22

33
/**
4-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015
4+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2016
55
* @package yii2-date-range
6-
* @version 1.6.5
6+
* @version 1.6.6
77
*/
88

99
namespace kartik\daterange;

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Additional enhancements added for this widget (by Krajee):
2727
You can see detailed [documentation](http://demos.krajee.com/date-range) on usage of the extension.
2828

2929
### Latest Release
30-
The latest version of the extension is release v1.6.5. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-date-range/blob/master/CHANGE.md) for details of various releases.
30+
The latest version of the extension is release v1.6.6. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-date-range/blob/master/CHANGE.md) for details of various releases.
3131

3232
## Installation
3333

assets/css/daterangepicker-kv.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
2-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
3-
* @version 1.6.5
2+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2016
3+
* @version 1.6.6
44
*
55
* Custom styling for DateRangePicker
66
*

assets/css/daterangepicker-kv.min.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
2-
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
3-
* @version 1.6.5
2+
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2016
3+
* @version 1.6.6
44
*
55
* Custom styling for DateRangePicker
66
*

assets/js/daterangepicker.js

+38-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @version: 2.1.13
2+
* @version: 2.1.17
33
* @author: Dan Grossman http://www.dangrossman.info/
44
* @copyright: Copyright (c) 2012-2015 Dan Grossman. All rights reserved.
55
* @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php
@@ -320,7 +320,7 @@
320320
//Support unicode chars in the range names.
321321
var elem = document.createElement('textarea');
322322
elem.innerHTML = range;
323-
rangeHtml = elem.value;
323+
var rangeHtml = elem.value;
324324

325325
this.ranges[rangeHtml] = [start, end];
326326
}
@@ -488,6 +488,8 @@
488488
if (this.dateLimit && this.startDate.clone().add(this.dateLimit).isBefore(this.endDate))
489489
this.endDate = this.startDate.clone().add(this.dateLimit);
490490

491+
this.previousRightTime = this.endDate.clone();
492+
491493
if (!this.isShowing)
492494
this.updateElement();
493495

@@ -567,7 +569,7 @@
567569
minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
568570
second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
569571
if (!this.timePicker24Hour) {
570-
var ampm = this.container.find('.left .ampmselect').val();
572+
var ampm = this.container.find('.right .ampmselect').val();
571573
if (ampm === 'PM' && hour < 12)
572574
hour += 12;
573575
if (ampm === 'AM' && hour === 12)
@@ -844,8 +846,32 @@
844846
selected = this.startDate.clone();
845847
minDate = this.minDate;
846848
} else if (side == 'right') {
847-
selected = this.endDate ? this.endDate.clone() : this.startDate.clone();
849+
selected = this.endDate ? this.endDate.clone() : this.previousRightTime.clone();
848850
minDate = this.startDate;
851+
852+
//Preserve the time already selected
853+
var timeSelector = this.container.find('.calendar.right .calendar-time div');
854+
if (timeSelector.html() != '') {
855+
856+
selected.hour(timeSelector.find('.hourselect option:selected').val() || selected.hour());
857+
selected.minute(timeSelector.find('.minuteselect option:selected').val() || selected.minute());
858+
selected.second(timeSelector.find('.secondselect option:selected').val() || selected.second());
859+
860+
if (!this.timePicker24Hour) {
861+
var ampm = timeSelector.find('.ampmselect option:selected').val();
862+
if (ampm === 'PM' && selected.hour() < 12)
863+
selected.hour(selected.hour() + 12);
864+
if (ampm === 'AM' && selected.hour() === 12)
865+
selected.hour(0);
866+
}
867+
868+
if (selected.isBefore(this.startDate))
869+
selected = this.startDate.clone();
870+
871+
if (selected.isAfter(maxDate))
872+
selected = maxDate.clone();
873+
874+
}
849875
}
850876

851877
//
@@ -1062,6 +1088,7 @@
10621088

10631089
this.oldStartDate = this.startDate.clone();
10641090
this.oldEndDate = this.endDate.clone();
1091+
this.previousRightTime = this.endDate.clone();
10651092

10661093
this.updateView();
10671094
this.container.show();
@@ -1254,7 +1281,7 @@
12541281
// * if single date picker mode, and time picker isn't enabled, apply the selection immediately
12551282
//
12561283

1257-
if (this.endDate || date.isBefore(this.startDate)) {
1284+
if (this.endDate || date.isBefore(this.startDate, 'day')) {
12581285
if (this.timePicker) {
12591286
var hour = parseInt(this.container.find('.left .hourselect').val(), 10);
12601287
if (!this.timePicker24Hour) {
@@ -1270,6 +1297,10 @@
12701297
}
12711298
this.endDate = null;
12721299
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());
12731304
} else {
12741305
if (this.timePicker) {
12751306
var hour = parseInt(this.container.find('.right .hourselect').val(), 10);
@@ -1489,5 +1520,7 @@
14891520
});
14901521
return this;
14911522
};
1523+
1524+
return DateRangePicker;
14921525

14931526
}));

assets/js/daterangepicker.min.js

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
{
22
"name": "kartik-v/yii2-date-range",
33
"description": "An advanced Yii 2 date range picker input for based on bootstrap-daterangepicker plugin.",
4-
"keywords": ["yii2", "extension", "widget", "date-range", "time", "date", "range", "bootstrap", "bootstrap 3"],
4+
"keywords": [
5+
"yii2",
6+
"extension",
7+
"widget",
8+
"date-range",
9+
"time",
10+
"date",
11+
"range",
12+
"bootstrap",
13+
"bootstrap 3"
14+
],
515
"homepage": "https://github.com/kartik-v/yii2-date-range",
616
"type": "yii2-extension",
717
"license": "BSD-3-Clause",

0 commit comments

Comments
 (0)