diff --git a/js/bootstrap-datepicker.js b/js/bootstrap-datepicker.js index f22b23674..18121b226 100644 --- a/js/bootstrap-datepicker.js +++ b/js/bootstrap-datepicker.js @@ -109,7 +109,7 @@ if (this.component && this.component.length === 0) this.component = false; - this.picker = $(DPGlobal.template); + this.picker = $(DPGlobal.template(this.o)); this._buildEvents(); this._attachEvents(); @@ -199,6 +199,9 @@ o.startView = Math.max(o.startView, o.minViewMode); + o.minutesStep = Math.max(defaults.minutesStep, o.minutesStep); + o.secondsStep = Math.max(defaults.secondsStep, o.secondsStep); + // true, false, or Number > 0 if (o.multidate !== true){ o.multidate = Number(o.multidate) || false; @@ -976,7 +979,7 @@ break; case 'today': var date = new Date(); - date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); + date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()); this.showMode(-2); var which = this.o.todayBtn === 'linked' ? null : 'view'; @@ -1302,6 +1305,7 @@ showTime: function(){ if (this.o.showTime) { this.picker.find('[name=ampm]').hide(); + this.picker.find('[name=second]').toggle(this.o.showSeconds); } else { if (!this.o.todayBtn && !this.o.clearBtn){ this.picker.find('tfoot').hide(); @@ -1473,10 +1477,13 @@ keyboardNavigation: true, language: 'en', minViewMode: 0, + minutesStep: 1, multidate: false, multidateSeparator: ',', orientation: "auto", rtl: false, + secondsStep: 1, + showSeconds: false, showTime: false, startDate: -Infinity, startView: 0, @@ -1596,13 +1603,13 @@ d: function(d,v){ return d.setUTCDate(v); }, - h: function(d,v) { + h: function(d,v){ return d.setUTCHours(v); }, - i: function(d,v) { + i: function(d,v){ return d.setUTCMinutes(v); }, - s: function(d,v) { + s: function(d,v){ return d.setUTCSeconds(v); } }, @@ -1662,10 +1669,7 @@ if (typeof format === 'string') format = DPGlobal.parseFormat(format); - var - hh = ('00' + date.getUTCHours()).slice(-2), - mi = ('00' + date.getUTCMinutes()).slice(-2), - ss = ('00' + date.getUTCSeconds()).slice(-2); + var hh = ('00' + date.getUTCHours()).slice(-2); var val = { d: date.getUTCDate(), @@ -1678,10 +1682,8 @@ yyyy: date.getUTCFullYear(), h: hh, H: hh, - i: mi, - I: mi, - s: ss, - S: ss + i: ('00' + date.getUTCMinutes()).slice(-2), + s: ('00' + date.getUTCSeconds()).slice(-2) }; val.dd = (val.d < 10 ? '0' : '') + val.d; @@ -1696,10 +1698,10 @@ return date.join(''); }, - timepickerTemplate: function(){ - var optionTags = function(min, max){ + timepickerTemplate: function (opts) { + var optionTags = function(min, max, step){ var s = ''; - for (var i = min; i < max; i++){ + for (var i = min; i < max; i += step || 1) { var val = ('0' + i).slice(-2); s += ''; } @@ -1707,17 +1709,17 @@ }; return ''+ - ''+ - ''+ optionTags(0, 24)+ ''+ - ''+ + optionTags(0, 60, opts.minutesStep) + ''+ - ''+ + optionTags(0, 60, opts.secondsStep) + ''+ - ''+ ''+ ''+ ''+ @@ -1738,40 +1740,43 @@ contTemplate: '' }; - DPGlobal.footTemplate = - '' + - DPGlobal.timepickerTemplate()+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''; - - DPGlobal.template = '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - ''+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'; + DPGlobal.footTemplate = function (opts) { + return '' + + DPGlobal.timepickerTemplate(opts) + + '' + + '' + + '' + + '' + + '' + + '' + + ''; + }; + + DPGlobal.template = function (options) { + return '
' + + '
' + + '' + + DPGlobal.headTemplate + + '' + + DPGlobal.footTemplate(options) + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate(options) + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate(options) + + '
' + + '
' + + '
'; + }; $.fn.datepicker.DPGlobal = DPGlobal; diff --git a/tests/suites/calendar-weeks.js b/tests/suites/calendar-weeks.js index 6c466f1d1..57a4c0239 100644 --- a/tests/suites/calendar-weeks.js +++ b/tests/suites/calendar-weeks.js @@ -8,7 +8,7 @@ module('Calendar Weeks', { calendarWeeks: true }) .focus(); // Activate for visibility checks - this.dp = this.input.data('datepicker') + this.dp = this.input.data('datepicker'); this.picker = this.dp.picker; }, teardown: function(){ diff --git a/tests/suites/component.js b/tests/suites/component.js index 399abd444..5cd104412 100644 --- a/tests/suites/component.js +++ b/tests/suites/component.js @@ -8,7 +8,7 @@ module('Component', { .datepicker({format: "dd-mm-yyyy"}); this.input = this.component.find('input'); this.addon = this.component.find('.add-on'); - this.dp = this.component.data('datepicker') + this.dp = this.component.data('datepicker'); this.picker = this.dp.picker; }, teardown: function(){ @@ -152,8 +152,8 @@ test('Selecting date resets viewDate and date', function(){ // Updated internally on click target.click(); - datesEqual(this.dp.viewDate, UTCDate(2012, 1, 26)) - datesEqual(this.dp.dates[0], UTCDate(2012, 1, 26)) + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 26)); + datesEqual(this.dp.dates[0], UTCDate(2012, 1, 26)); // Re-rendered on click target = this.picker.find('.datepicker-days tbody td:first'); diff --git a/tests/suites/events.js b/tests/suites/events.js index 80703d1f9..2092a9ee4 100644 --- a/tests/suites/events.js +++ b/tests/suites/events.js @@ -4,7 +4,7 @@ module('Events', { .appendTo('#qunit-fixture') .datepicker({format: "dd-mm-yyyy"}) .focus(); // Activate for visibility checks - this.dp = this.input.data('datepicker') + this.dp = this.input.data('datepicker'); this.picker = this.dp.picker; }, teardown: function(){ @@ -153,7 +153,7 @@ test('format() returns a formatted date string', function(){ datesEqual(this.dp.viewDate, UTCDate(2011, 2, 14)); datesEqual(this.dp.dates[0], UTCDate(2011, 2, 14)); - equal(error, undefined) + equal(error, undefined); equal(out, '14-03-2011'); }); @@ -176,7 +176,7 @@ test('format(altformat) returns a formatted date string', function(){ datesEqual(this.dp.viewDate, UTCDate(2011, 2, 14)); datesEqual(this.dp.dates[0], UTCDate(2011, 2, 14)); - equal(error, undefined) + equal(error, undefined); equal(out, '3/14/11'); }); diff --git a/tests/suites/formats.js b/tests/suites/formats.js index 63507184b..dbd48889b 100644 --- a/tests/suites/formats.js +++ b/tests/suites/formats.js @@ -88,6 +88,38 @@ test('yyyy: Year, four-digit.', function(){ equal(this.input.val().split('-')[0], '2012'); }); +test('h: Hours, 24-hour clock, leading zero.', function(){ + this.input + .val('2012-03-5-9-33-59') + .datepicker({format: 'yyyy-mm-dd-h-i-s'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[3], '09'); +}); + +test('H: Hours, 24-hour clock, leading zero.', function(){ + this.input + .val('2012-03-5-9-33-59') + .datepicker({format: 'yyyy-mm-dd-H-i-s'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[3], '09'); +}); + +test('i: Minutes, leading zero', function(){ + this.input + .val('2012-03-5-15-9-59') + .datepicker({format: 'yyyy-mm-dd-h-i-s'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[4], '09'); +}); + +test('s: Seconds, leading zero', function(){ + this.input + .val('2012-03-5-15-33-9') + .datepicker({format: 'yyyy-mm-dd-h-i-s'}) + .datepicker('setValue'); + equal(this.input.val().split('-')[5], '09'); +}); + test('dd-mm-yyyy: Regression: Prevent potential month overflow in small-to-large formats (Mar 31, 2012 -> Mar 01, 2012)', function(){ this.input .val('31-03-2012') diff --git a/tests/suites/inline.js b/tests/suites/inline.js index feb274244..e2b7e9c5f 100644 --- a/tests/suites/inline.js +++ b/tests/suites/inline.js @@ -3,7 +3,7 @@ module('Inline', { this.component = $('
') .appendTo('#qunit-fixture') .datepicker({format: "dd-mm-yyyy"}); - this.dp = this.component.data('datepicker') + this.dp = this.component.data('datepicker'); this.picker = this.dp.picker; }, teardown: function(){ @@ -23,6 +23,6 @@ test('Visible after init', function(){ }); test('update', function(){ - this.dp.update('13-03-2012') + this.dp.update('13-03-2012'); datesEqual(this.dp.dates[0], UTCDate(2012, 2, 13)); }); diff --git a/tests/suites/keyboard_navigation/2011.js b/tests/suites/keyboard_navigation/2011.js index 5add79078..2faf93e97 100644 --- a/tests/suites/keyboard_navigation/2011.js +++ b/tests/suites/keyboard_navigation/2011.js @@ -10,7 +10,7 @@ module('Keyboard Navigation 2011', { .appendTo('#qunit-fixture') .datepicker({format: "dd-mm-yyyy"}) .focus(); // Activate for visibility checks - this.dp = this.input.data('datepicker') + this.dp = this.input.data('datepicker'); this.picker = this.dp.picker; }, teardown: function(){ diff --git a/tests/suites/keyboard_navigation/2012.js b/tests/suites/keyboard_navigation/2012.js index 2b0c21552..6288b613a 100644 --- a/tests/suites/keyboard_navigation/2012.js +++ b/tests/suites/keyboard_navigation/2012.js @@ -12,7 +12,7 @@ module('Keyboard Navigation 2012', { .appendTo('#qunit-fixture') .datepicker({format: "dd-mm-yyyy"}) .focus(); // Activate for visibility checks - this.dp = this.input.data('datepicker') + this.dp = this.input.data('datepicker'); this.picker = this.dp.picker; }, teardown: function(){ diff --git a/tests/suites/keyboard_navigation/all.js b/tests/suites/keyboard_navigation/all.js index 6c00fd472..cf8a53680 100644 --- a/tests/suites/keyboard_navigation/all.js +++ b/tests/suites/keyboard_navigation/all.js @@ -4,7 +4,7 @@ module('Keyboard Navigation (All)', { .appendTo('#qunit-fixture') .datepicker({format: "dd-mm-yyyy"}) .focus(); // Activate for visibility checks - this.dp = this.input.data('datepicker') + this.dp = this.input.data('datepicker'); this.picker = this.dp.picker; }, teardown: function(){ diff --git a/tests/suites/mouse_navigation/2011.js b/tests/suites/mouse_navigation/2011.js index 11d14b8ae..9aa462801 100644 --- a/tests/suites/mouse_navigation/2011.js +++ b/tests/suites/mouse_navigation/2011.js @@ -7,7 +7,7 @@ module('Mouse Navigation 2011', { .appendTo('#qunit-fixture') .datepicker({format: "dd-mm-yyyy"}) .focus(); // Activate for visibility checks - this.dp = this.input.data('datepicker') + this.dp = this.input.data('datepicker'); this.picker = this.dp.picker; }, teardown: function(){ @@ -20,8 +20,8 @@ test('Selecting date from previous month while in January changes month and year this.input.val('01-01-2011'); this.dp.update(); - datesEqual(this.dp.viewDate, UTCDate(2011, 0, 1)) - datesEqual(this.dp.dates.get(-1), UTCDate(2011, 0, 1)) + datesEqual(this.dp.viewDate, UTCDate(2011, 0, 1)); + datesEqual(this.dp.dates.get(-1), UTCDate(2011, 0, 1)); // Rendered correctly equal(this.dp.viewMode, 0); @@ -32,8 +32,8 @@ test('Selecting date from previous month while in January changes month and year // Updated internally on click target.click(); equal(this.picker.find('.datepicker-days thead th.datepicker-switch').text(), 'December 2010'); - datesEqual(this.dp.viewDate, UTCDate(2010, 11, 26)) - datesEqual(this.dp.dates.get(-1), UTCDate(2010, 11, 26)) + datesEqual(this.dp.viewDate, UTCDate(2010, 11, 26)); + datesEqual(this.dp.dates.get(-1), UTCDate(2010, 11, 26)); // Re-rendered on click target = this.picker.find('.datepicker-days tbody td:first'); @@ -45,8 +45,8 @@ test('Selecting date from next month while in December changes month and year di this.input.val('01-12-2010'); this.dp.update(); - datesEqual(this.dp.viewDate, UTCDate(2010, 11, 1)) - datesEqual(this.dp.dates.get(-1), UTCDate(2010, 11, 1)) + datesEqual(this.dp.viewDate, UTCDate(2010, 11, 1)); + datesEqual(this.dp.dates.get(-1), UTCDate(2010, 11, 1)); // Rendered correctly equal(this.dp.viewMode, 0); @@ -57,8 +57,8 @@ test('Selecting date from next month while in December changes month and year di // Updated internally on click target.click(); equal(this.picker.find('.datepicker-days thead th.datepicker-switch').text(), 'January 2011'); - datesEqual(this.dp.viewDate, UTCDate(2011, 0, 8)) - datesEqual(this.dp.dates.get(-1), UTCDate(2011, 0, 8)) + datesEqual(this.dp.viewDate, UTCDate(2011, 0, 8)); + datesEqual(this.dp.dates.get(-1), UTCDate(2011, 0, 8)); // Re-rendered on click target = this.picker.find('.datepicker-days tbody td:first'); diff --git a/tests/suites/mouse_navigation/2012.js b/tests/suites/mouse_navigation/2012.js index c3daa8ea5..f483256dc 100644 --- a/tests/suites/mouse_navigation/2012.js +++ b/tests/suites/mouse_navigation/2012.js @@ -12,7 +12,7 @@ module('Mouse Navigation 2012', { .appendTo('#qunit-fixture') .datepicker({format: "dd-mm-yyyy"}) .focus(); // Activate for visibility checks - this.dp = this.input.data('datepicker') + this.dp = this.input.data('datepicker'); this.picker = this.dp.picker; }, teardown: function(){ @@ -30,8 +30,8 @@ test('Selecting date resets viewDate and date', function(){ // Updated internally on click target.click(); - datesEqual(this.dp.viewDate, UTCDate(2012, 2, 4)) - datesEqual(this.dp.dates.get(-1), UTCDate(2012, 2, 4)) + datesEqual(this.dp.viewDate, UTCDate(2012, 2, 4)); + datesEqual(this.dp.dates.get(-1), UTCDate(2012, 2, 4)); // Re-rendered on click target = this.picker.find('.datepicker-days tbody td:first'); @@ -219,8 +219,8 @@ test('Selecting date from previous month resets viewDate and date, changing mont // Updated internally on click target.click(); equal(this.picker.find('.datepicker-days thead th.datepicker-switch').text(), 'February 2012'); - datesEqual(this.dp.viewDate, UTCDate(2012, 1, 26)) - datesEqual(this.dp.dates.get(-1), UTCDate(2012, 1, 26)) + datesEqual(this.dp.viewDate, UTCDate(2012, 1, 26)); + datesEqual(this.dp.dates.get(-1), UTCDate(2012, 1, 26)); // Re-rendered on click target = this.picker.find('.datepicker-days tbody td:first'); @@ -242,8 +242,8 @@ test('Selecting date from next month resets viewDate and date, changing month di // Updated internally on click target.click(); equal(this.picker.find('.datepicker-days thead th.datepicker-switch').text(), 'May 2012'); - datesEqual(this.dp.viewDate, UTCDate(2012, 4, 5)) - datesEqual(this.dp.dates.get(-1), UTCDate(2012, 4, 5)) + datesEqual(this.dp.viewDate, UTCDate(2012, 4, 5)); + datesEqual(this.dp.dates.get(-1), UTCDate(2012, 4, 5)); // Re-rendered on click target = this.picker.find('.datepicker-days tbody td:first'); diff --git a/tests/suites/mouse_navigation/all.js b/tests/suites/mouse_navigation/all.js index 0dc7502f7..5f1436e8a 100644 --- a/tests/suites/mouse_navigation/all.js +++ b/tests/suites/mouse_navigation/all.js @@ -4,7 +4,7 @@ module('Mouse Navigation (All)', { .appendTo('#qunit-fixture') .datepicker({format: "dd-mm-yyyy"}) .focus(); // Activate for visibility checks - this.dp = this.input.data('datepicker') + this.dp = this.input.data('datepicker'); this.picker = this.dp.picker; }, teardown: function(){ diff --git a/tests/suites/options.js b/tests/suites/options.js index 6682058d5..554366846 100644 --- a/tests/suites/options.js +++ b/tests/suites/options.js @@ -33,6 +33,31 @@ test('Autoclose', function(){ datesEqual(dp.viewDate, UTCDate(2012, 2, 4)); }); +test('Autoclose with showTime', function () { + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05 15:9:57') + .datepicker({ + format: 'yyyy-mm-dd h:i:s', + showTime: true, + autoclose: true // should be ignored + }), + dp = input.data('datepicker'), + picker = dp.picker, + target; + + input.focus(); + ok(picker.is(':visible'), 'Picker is visible'); + target = picker.find('.datepicker-days tbody td:nth(7)'); + equal(target.text(), '4'); // Mar 4 + + target.click(); + // It still should be visible + ok(picker.is(':visible'), 'Picker is visible'); + datesEqual(dp.dates[0], UTCDate(2012, 2, 4, 15, 9, 57)); + datesEqual(dp.viewDate, UTCDate(2012, 2, 4, 15, 9, 57)); +}); + test('Startview: year view (integer)', function(){ var input = $('') .appendTo('#qunit-fixture') @@ -182,7 +207,7 @@ test('Today Button: moves to today\'s date', function(){ target.click(); var d = new Date(), - today = UTCDate(d.getFullYear(), d.getMonth(), d.getDate()); + today = UTCDate(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds()); datesEqual(dp.viewDate, today); datesEqual(dp.dates[0], UTCDate(2012, 2, 5)); }); @@ -207,7 +232,7 @@ test('Today Button: "linked" selects today\'s date', function(){ target.click(); var d = new Date(), - today = UTCDate(d.getFullYear(), d.getMonth(), d.getDate()); + today = UTCDate(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds()); datesEqual(dp.viewDate, today); datesEqual(dp.dates[0], today); }); @@ -305,7 +330,7 @@ test('Clear Button: clears input value', function(){ target = picker.find('.datepicker-days tfoot .clear'); target.click(); - equal(input.val(),'',"Input value has been cleared.") + equal(input.val(),'',"Input value has been cleared."); ok(picker.is(':visible'), 'Picker is visible'); }); @@ -646,3 +671,159 @@ test('Multidate Separator', function(){ target.click(); equal(input.val(), '2012-03-05 2012-03-04 2012-03-12'); }); + +test('showTime', function () { + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05 15:9:57') + .datepicker({ + format: 'yyyy-mm-dd h:i:s', + showTime: true + }), + dp = input.data('datepicker'), + picker = dp.picker, + target, select; + + input.focus(); + ok(picker.is(':visible'), 'Picker is visible'); + + target = picker.find('.datepicker-days tfoot th.timepicker'); + ok(target.is(':visible'), 'Timepicker is visible'); + + // First find the hours + select = target.find('select.time[name=hour]'); + ok(select.is(':visible'), 'Hours is visible'); + equal(select.val(), '15'); + select.val('17'); + // Minutes + select = target.find('select.time[name=minute]'); + ok(select.is(':visible'), 'Minutes is visible'); + equal(select.val(), '09'); + select.val('59'); + // Seconds + ok(target.find('select.time[name=second]').is(':not(:visible)'), 'Seconds is hidden by default'); + + ok(target.find('select.time[name=ampm]').is(':not(:visible)'), 'AM/PM is hidden by default'); + + target.find('button').click(); + ok(picker.is(':not(:visible)'), 'Picker is hidden'); + datesEqual(dp.dates[0], UTCDate(2012, 2, 5, 17, 59, 57)); + datesEqual(dp.viewDate, UTCDate(2012, 2, 5, 17, 59, 57)); +}); + +test('minutesStep', function () { + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05 15:10:57') + .datepicker({ + format: 'yyyy-mm-dd h:i:s', + showTime: true, + minutesStep: 5 + }), + dp = input.data('datepicker'), + picker = dp.picker, + select = picker.find('.datepicker-days tfoot th.timepicker select.time[name=minute]'); + + input.focus(); + + equal(select.children('option:first').val(), '00'); + equal(select.children('option:eq(1)').val(), '05'); + equal(select.children('option').length, 12); +}); + +test('minutesStep with negative value', function () { + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05 15:9:57') + .datepicker({ + format: 'yyyy-mm-dd h:i:s', + showTime: true, + minutesStep: -2 + }), + dp = input.data('datepicker'), + picker = dp.picker, + select = picker.find('.datepicker-days tfoot th.timepicker select.time[name=minute]'); + + input.focus(); + + equal(select.children('option:first').val(), '00'); + equal(select.children('option:eq(1)').val(), '01'); + equal(select.children('option').length, 60); +}); + +// test('minutesStep round value', function () { + // TODO +// }); + +test('secondsStep', function () { + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05 15:9:55') + .datepicker({ + format: 'yyyy-mm-dd h:i:s', + showTime: true, + secondsStep: 5 + }), + dp = input.data('datepicker'), + picker = dp.picker, + select = picker.find('.datepicker-days tfoot th.timepicker select.time[name=second]'); + + input.focus(); + + equal(select.children('option:first').val(), '00'); + equal(select.children('option:eq(1)').val(), '05'); + equal(select.children('option').length, 12); +}); + +test('secondsStep with negative value', function () { + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05 15:9:55') + .datepicker({ + format: 'yyyy-mm-dd h:i:s', + showTime: true, + secondsStep: -2 + }), + dp = input.data('datepicker'), + picker = dp.picker, + select = picker.find('.datepicker-days tfoot th.timepicker select.time[name=second]'); + + input.focus(); + + equal(select.children('option:first').val(), '00'); + equal(select.children('option:eq(1)').val(), '01'); + equal(select.children('option').length, 60); +}); + +// test('secondsStep round value', function () { + // TODO +// }); + +test('showSeconds', function () { + var input = $('') + .appendTo('#qunit-fixture') + .val('2012-03-05 15:9:57') + .datepicker({ + format: 'yyyy-mm-dd h:i:s', + showSeconds: true, + showTime: true + }), + dp = input.data('datepicker'), + picker = dp.picker, + target, select; + + input.focus(); + + target = picker.find('.datepicker-days tfoot th.timepicker'); + + // Seconds + select = target.find('select.time[name=second]'); + ok(select.is(':visible'), 'Seconds is visible'); + equal(select.val(), '57'); + select.val('02'); + + target.find('button').click(); + ok(picker.is(':not(:visible)'), 'Picker is hidden'); + datesEqual(dp.dates[0], UTCDate(2012, 2, 5, 15, 9, 2)); + datesEqual(dp.viewDate, UTCDate(2012, 2, 5, 15, 9, 2)); +});