Skip to content

Commit

Permalink
Update to release v1.6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Jan 11, 2016
1 parent c6cb19d commit 41c4717
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 25 deletions.
7 changes: 7 additions & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Change Log: `yii2-date-range`
=============================

## Version 1.6.6

**Date:** 11-Jan-2016

- (enh #55): Enhancements for PJAX based reinitialization. Complements enhancements in kartik-v/yii2-krajee-base#52 and kartik-v/yii2-krajee-base#53.
- (enh #56): Update to latest version of bootstrap-daterangepicker.

## Version 1.6.5

**Date:** 22-Oct-2015
Expand Down
12 changes: 6 additions & 6 deletions DateRangePicker.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2016
* @package yii2-date-range
* @version 1.6.5
* @version 1.6.6
*/

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

/**
* @inherit doc
* @inheritdoc
*/
protected $_pluginName = 'daterangepicker';
public $pluginName = 'daterangepicker';

/**
* @var string locale language to be used for the plugin
Expand Down Expand Up @@ -323,12 +323,12 @@ public function registerAssets()
} elseif (!$this->autoUpdateOnInit) {
$script = "var val={$val};{$change}";
} else {
$this->registerPlugin($this->_pluginName, $id);
$this->registerPlugin($this->pluginName, $id);
return;
}
$this->callback = "function(start,end,label){{$script}}";
}
$this->registerPlugin($this->_pluginName, $id, null, $this->callback);
$this->registerPlugin($this->pluginName, $id, null, $this->callback);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions DateRangePickerAsset.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2016
* @package yii2-date-range
* @version 1.6.5
* @version 1.6.6
*/

namespace kartik\daterange;
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015, Kartik Visweswaran
Copyright (c) 2015 - 2016, Kartik Visweswaran
Krajee.com
All rights reserved.

Expand Down
4 changes: 2 additions & 2 deletions LanguageAsset.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2016
* @package yii2-date-range
* @version 1.6.5
* @version 1.6.6
*/

namespace kartik\daterange;
Expand Down
4 changes: 2 additions & 2 deletions MomentAsset.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2016
* @package yii2-date-range
* @version 1.6.5
* @version 1.6.6
*/

namespace kartik\daterange;
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Additional enhancements added for this widget (by Krajee):
You can see detailed [documentation](http://demos.krajee.com/date-range) on usage of the extension.

### Latest Release
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.
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.

## Installation

Expand Down
4 changes: 2 additions & 2 deletions assets/css/daterangepicker-kv.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @version 1.6.5
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2016
* @version 1.6.6
*
* Custom styling for DateRangePicker
*
Expand Down
4 changes: 2 additions & 2 deletions assets/css/daterangepicker-kv.min.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @version 1.6.5
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2015 - 2016
* @version 1.6.6
*
* Custom styling for DateRangePicker
*
Expand Down
43 changes: 38 additions & 5 deletions assets/js/daterangepicker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @version: 2.1.13
* @version: 2.1.17
* @author: Dan Grossman http://www.dangrossman.info/
* @copyright: Copyright (c) 2012-2015 Dan Grossman. All rights reserved.
* @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php
Expand Down Expand Up @@ -320,7 +320,7 @@
//Support unicode chars in the range names.
var elem = document.createElement('textarea');
elem.innerHTML = range;
rangeHtml = elem.value;
var rangeHtml = elem.value;

this.ranges[rangeHtml] = [start, end];
}
Expand Down Expand Up @@ -488,6 +488,8 @@
if (this.dateLimit && this.startDate.clone().add(this.dateLimit).isBefore(this.endDate))
this.endDate = this.startDate.clone().add(this.dateLimit);

this.previousRightTime = this.endDate.clone();

if (!this.isShowing)
this.updateElement();

Expand Down Expand Up @@ -567,7 +569,7 @@
minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
if (!this.timePicker24Hour) {
var ampm = this.container.find('.left .ampmselect').val();
var ampm = this.container.find('.right .ampmselect').val();
if (ampm === 'PM' && hour < 12)
hour += 12;
if (ampm === 'AM' && hour === 12)
Expand Down Expand Up @@ -844,8 +846,32 @@
selected = this.startDate.clone();
minDate = this.minDate;
} else if (side == 'right') {
selected = this.endDate ? this.endDate.clone() : this.startDate.clone();
selected = this.endDate ? this.endDate.clone() : this.previousRightTime.clone();
minDate = this.startDate;

//Preserve the time already selected
var timeSelector = this.container.find('.calendar.right .calendar-time div');
if (timeSelector.html() != '') {

selected.hour(timeSelector.find('.hourselect option:selected').val() || selected.hour());
selected.minute(timeSelector.find('.minuteselect option:selected').val() || selected.minute());
selected.second(timeSelector.find('.secondselect option:selected').val() || selected.second());

if (!this.timePicker24Hour) {
var ampm = timeSelector.find('.ampmselect option:selected').val();
if (ampm === 'PM' && selected.hour() < 12)
selected.hour(selected.hour() + 12);
if (ampm === 'AM' && selected.hour() === 12)
selected.hour(0);
}

if (selected.isBefore(this.startDate))
selected = this.startDate.clone();

if (selected.isAfter(maxDate))
selected = maxDate.clone();

}
}

//
Expand Down Expand Up @@ -1062,6 +1088,7 @@

this.oldStartDate = this.startDate.clone();
this.oldEndDate = this.endDate.clone();
this.previousRightTime = this.endDate.clone();

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

if (this.endDate || date.isBefore(this.startDate)) {
if (this.endDate || date.isBefore(this.startDate, 'day')) {
if (this.timePicker) {
var hour = parseInt(this.container.find('.left .hourselect').val(), 10);
if (!this.timePicker24Hour) {
Expand All @@ -1270,6 +1297,10 @@
}
this.endDate = null;
this.setStartDate(date.clone());
} else if (!this.endDate && date.isBefore(this.startDate)) {
//special case: clicking the same date for start/end,
//but the time of the end date is before the start date
this.setEndDate(this.startDate.clone());
} else {
if (this.timePicker) {
var hour = parseInt(this.container.find('.right .hourselect').val(), 10);
Expand Down Expand Up @@ -1489,5 +1520,7 @@
});
return this;
};

return DateRangePicker;

}));
4 changes: 3 additions & 1 deletion assets/js/daterangepicker.min.js

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
{
"name": "kartik-v/yii2-date-range",
"description": "An advanced Yii 2 date range picker input for based on bootstrap-daterangepicker plugin.",
"keywords": ["yii2", "extension", "widget", "date-range", "time", "date", "range", "bootstrap", "bootstrap 3"],
"keywords": [
"yii2",
"extension",
"widget",
"date-range",
"time",
"date",
"range",
"bootstrap",
"bootstrap 3"
],
"homepage": "https://github.com/kartik-v/yii2-date-range",
"type": "yii2-extension",
"license": "BSD-3-Clause",
Expand Down

0 comments on commit 41c4717

Please sign in to comment.