Skip to content
This repository was archived by the owner on Dec 15, 2017. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "bootstrap"]
path = bootstrap
url = git://github.com/twitter/bootstrap.git
url = git://github.com/twbs/bootstrap.git

2 changes: 1 addition & 1 deletion bootstrap
Submodule bootstrap updated 113 files
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.

2 changes: 1 addition & 1 deletion build/js/bootstrap-datetimepicker.min.js

Large diffs are not rendered by default.

29 changes: 23 additions & 6 deletions src/js/bootstrap-datetimepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
this.fillDow();
this.fillMonths();
this.fillHours();
this.fillMinutes();
this.fillMinutes(options.timeRows, options.timeCols, options.timeInterval);
this.fillSeconds();
this.update();
this.showMode();
Expand Down Expand Up @@ -291,6 +291,20 @@
this.widget.removeClass('pull-right');
}

if ($window.height() < this.$element.offset().top + this.$element.height() + this.widget.outerHeight()) {
offset.top = this.$element.offset().top - this.widget.outerHeight() - 2;
if (260 == this.widget.outerHeight()) {
this.widget.removeClass('pull-bottom-time');
this.widget.addClass('pull-bottom-calendar');
} else {
this.widget.removeClass('pull-bottom-calendar');
this.widget.addClass('pull-bottom-time');
}
} else {
this.widget.removeClass('pull-bottom-calendar');
this.widget.removeClass('pull-bottom-time');
}

this.widget.css({
position: position,
top: offset.top,
Expand Down Expand Up @@ -490,18 +504,18 @@
table.html(html);
},

fillMinutes: function() {
fillMinutes: function(rows, cols, interval) {
var table = this.widget.find(
'.timepicker .timepicker-minutes table');
table.parent().hide();
var html = '';
var current = 0;
for (var i = 0; i < 5; i++) {
for (var i = 0; i < rows; i++) {
html += '<tr>';
for (var j = 0; j < 4; j += 1) {
for (var j = 0; j < cols; j += 1) {
var c = current.toString();
html += '<td class="minute">' + padLeft(c, 2, '0') + '</td>';
current += 3;
current += interval;
}
html += '</tr>';
}
Expand Down Expand Up @@ -1095,7 +1109,10 @@
pickSeconds: true,
startDate: -Infinity,
endDate: Infinity,
collapse: true
collapse: true,
timeRows: 5,
timeCols: 4,
timeInterval: 3
};
$.fn.datetimepicker.Constructor = DateTimePicker;
var dpgId = 0;
Expand Down
44 changes: 44 additions & 0 deletions src/less/bootstrap-datetimepicker.less
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,50 @@
right: 7px;
}
}
&.pull-bottom-calendar {
&:before {
border-bottom: 0;
border-top: 7px solid rgba(0, 0, 0, 0.2);
top: 259px;
}
&:after {
border-bottom: 0;
border-top: 6px solid white;
top: 258px;
}
&.pull-right{
&:before {
right: 6px;
left:auto;
}
&:after {
right: 7px;
left:auto;
}
}
}
&.pull-bottom-time {
&:before {
border-bottom: 0;
border-top: 7px solid rgba(0, 0, 0, 0.2);
top: 177px;
}
&:after {
border-bottom: 0;
border-top: 6px solid white;
top: 176px;
}
&.pull-right{
&:before {
right: 6px;
left:auto;
}
&:after {
right: 7px;
left:auto;
}
}
}
>ul {
list-style-type: none;
margin: 0;
Expand Down