Skip to content
This repository has been archived by the owner on Feb 14, 2019. It is now read-only.

Fix resetting of viewDate #619

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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 js/bootstrap-datetimepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@
this.picker.hide();
$(window).off('resize', this.place);
this.viewMode = this.startViewMode;
this.viewDate = new Date(this.date);
this.showMode();
if (!this.isInput) {
$(document).off('mousedown', this.hide);
Expand Down Expand Up @@ -546,7 +547,7 @@
this.datesDisabled = $.map(this.datesDisabled, function (d) {
return DPGlobal.parseDate(d, mThis.format, mThis.language, mThis.formatType, mThis.timezone).toDateString();
});
this.update();
this.fill();
this.updateNavArrows();
},

Expand Down
4 changes: 2 additions & 2 deletions tests/run-qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ page.onError = function (msg, trace) {
console.log(' ', item.file, ':', item.line);
})
}

var _openPath = phantom.args[0].replace(/^.*(\\|\/)/, '');
args = system.args.toString().split(',');
var _openPath = args[1].replace(/^.*(\\|\/)/, '');
var openPath = _openPath;
var origdir = '../js/';
var basedir = '../instrumented/';
Expand Down
17 changes: 17 additions & 0 deletions tests/suites/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,23 @@ test('DaysOfWeekDisabled', function(){
ok(target.hasClass('disabled'), 'Day of week is disabled');
});

test('setDatesDisabled', function(){
var input = $('<input />')
.appendTo('#qunit-fixture')
.val('2012-10-26')
.datetimepicker({
format: 'yyyy-mm-dd',
}),
dp = input.data('datetimepicker'),
picker = dp.picker,
target;

input.datetimepicker('setDatesDisabled', ['2012-10-28']);
input.focus();
target = picker.find('.datetimepicker-days tbody td:nth(28)');
ok(target.hasClass('disabled'), 'Set dates disabled');
});

test('startDate: Custom value', function(){
var input = $('<input />')
.appendTo('#qunit-fixture')
Expand Down