Skip to content

Commit

Permalink
Version 2.1.30
Browse files Browse the repository at this point in the history
Important! build.less file name has been been changed to
bootstrap-datetimepicker-build.less to prevent collisions

Fix for #135: setStartDate and setEndDate should now properly set.
Fix for #133: Typed in date now respects en/disabled dates
Fix for #132: En/disable picker function works again
Fix for #117, #119, #128, #121: double event change event issues should
be fixed
Fix for #112: change function no longer sets the input to a blank value
if the passed in date is invalid

Enhancement for #103: Increated the z-index of the widget
  • Loading branch information
Eonasdan committed Jan 25, 2014
1 parent da354a5 commit 93d856c
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 29 deletions.
2 changes: 1 addition & 1 deletion build/css/bootstrap-datetimepicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
width: 250px;
padding: 4px;
margin-top: 1px;
z-index: 9999;
z-index: 99999;
border-radius: 4px;
/*.dow {
border-top: 1px solid #ddd !important;
Expand Down
2 changes: 1 addition & 1 deletion build/css/bootstrap-datetimepicker.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build/js/bootstrap-datetimepicker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-datetimepicker",
"version": "2.1.20",
"version": "2.1.30",
"main": ["build/css/bootstrap-datetimepicker.min.css","build/js/bootstrap-datetimepicker.min.js"],
"dependencies": {
"jquery" : ">=1.8.3",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-datetimepicker",
"version": "2.1.20",
"version": "2.1.30",
"repository": {
"type": "git",
"url": "git://github.com/eonasdan/bootstrap-datetimepicker.git"
Expand Down
45 changes: 25 additions & 20 deletions src/js/bootstrap-datetimepicker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* version 2.1.20
* version 2.1.30
* @license
* =========================================================
* bootstrap-datetimepicker.js
Expand Down Expand Up @@ -67,7 +67,8 @@
disabledDates: [],
enabledDates: false,
icons: {},
useStrict: false
useStrict: false,
direction: "auto"
},

icons = {
Expand Down Expand Up @@ -225,8 +226,14 @@
offset = picker.component ? picker.component.offset() : picker.element.offset(), $window = $(window);
picker.width = picker.component ? picker.component.outerWidth() : picker.element.outerWidth();
offset.top = offset.top + picker.element.outerHeight();

//if (offset.top + picker.widget.height() > $window.height()) offset.top = offset.top - (picker.widget.height() + picker.height + 10);

// if (picker.options.direction === 'up' || picker.options.direction === 'auto' && offset.top + picker.widget.height() > $window.height()) {
// offset.top -= picker.widget.height() + picker.element.outerHeight();
// picker.widget.addClass('up');
// } else if (picker.options.direction === 'down' || picker.options.direction === 'auto' && offset.top + picker.widget.height() <= $window.height()) {
// offset.top += picker.element.outerHeight();
// picker.widget.addClass('down');
// }

if (picker.options.width !== undefined) {
picker.widget.width(picker.options.width);
Expand Down Expand Up @@ -365,7 +372,7 @@
if (prevMonth.isSame(pMoment({ y: picker.date.year(), M: picker.date.month(), d: picker.date.date() }))) {
clsName += ' active';
}
if ((pMoment(prevMonth).add(1, "d") <= picker.options.startDate) || (prevMonth > picker.options.endDate) || isInDisableDates(prevMonth) || !isInEnableDates(prevMonth)) {
if (isInDisableDates(prevMonth) || !isInEnableDates(prevMonth)) {
clsName += ' disabled';
}
row.append('<td class="day' + clsName + '">' + prevMonth.date() + '</td>');
Expand Down Expand Up @@ -652,20 +659,20 @@

change = function (e) {
pMoment.lang(picker.options.language);
var input = $(e.target), oldDate = pMoment(picker.date), d = pMoment(input.val(), picker.format, picker.options.useStrict);
if (d.isValid()) {
var input = $(e.target), oldDate = pMoment(picker.date), newDate = pMoment(input.val(), picker.format, picker.options.useStrict);
if (newDate.isValid() && !isInDisableDates(newDate) && isInEnableDates(newDate)) {
update();
picker.setValue(d);
picker.setValue(newDate);
notifyChange(oldDate, e.type);
set();
}
else {
picker.viewDate = oldDate;
input.val(pMoment(oldDate).format(picker.format));
//picker.setValue(""); // unset the date when the input is erased
notifyChange(oldDate, e.type);
notifyError(d);
notifyError(newDate);
picker.unset = true;
input.val('');
}
},

Expand Down Expand Up @@ -801,7 +808,7 @@
else {
newDate = pMoment(picker.date).subtract(amount, unit);
}
if (newDate.isAfter(picker.options.endDate) || pMoment(newDate.subtract(amount, unit)).isBefore(picker.options.startDate) || isInDisableDates(newDate)) {
if (isInDisableDates(pMoment(newDate.subtract(amount, unit))) || isInDisableDates(newDate)) {
notifyError(newDate.format(picker.format));
return;
}
Expand All @@ -812,10 +819,12 @@
else {
picker.date.subtract(amount, unit);
}
picker.unset = false;
},

isInDisableDates = function (date) {
pMoment.lang(picker.options.language);
if (date.isAfter(picker.options.endDate) || date.isBefore(picker.options.startDate)) return true;
var disabled = picker.options.disabledDates, i;
for (i in disabled) {
if (disabled[i] == pMoment(date).format("L")) {
Expand Down Expand Up @@ -985,7 +994,7 @@

picker.disable = function () {
var input = picker.element.find('input');
if(!input.prop('disabled')) return;
if(input.prop('disabled')) return;

input.prop('disabled', true);
detachDatePickerEvents();
Expand All @@ -995,7 +1004,7 @@
var input = picker.element.find('input');
if(!input.prop('disabled')) return;

input.prop('disabled', true);
input.prop('disabled', false);
attachDatePickerEvents();
},

Expand Down Expand Up @@ -1057,18 +1066,14 @@
},

picker.setEndDate = function (date) {
if (date == undefined) return;
picker.options.endDate = pMoment(date);
if (!picker.options.endDate.isValid()) {
picker.options.endDate = pMoment().add(50, "y");
}
if (picker.viewDate) update();
},

picker.setStartDate = function (date) {
if (date == undefined) return;
picker.options.startDate = pMoment(date);
if (!picker.options.startDate.isValid()) {
picker.options.startDate = pMoment({ y: 1970 });
}
if (picker.viewDate) update();
};

Expand All @@ -1081,4 +1086,4 @@
if (!data) $this.data('DateTimePicker', new DateTimePicker(this, options));
});
};
}));
}));
4 changes: 2 additions & 2 deletions src/less/build.less → src/less/bootstrap-datetimepicker-build.less
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Import boostrap variables including default color palette and fonts
@import "../../bootstrap/less/variables";
@import "../bootstrap/variables.less";

// Import datepicker component
@import "bootstrap-datetimepicker";
@import "bootstrap-datetimepicker.less";
2 changes: 1 addition & 1 deletion src/less/bootstrap-datetimepicker.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
width: 250px;
padding: 4px;
margin-top: 1px;
z-index: 9999;
z-index: 99999;
border-radius: 4px;

.btn {
Expand Down

0 comments on commit 93d856c

Please sign in to comment.