eonasdan-bootstrap-datetimepicker
Version:
A date/time picker component designed to work with Bootstrap 3 and Momentjs. For usage, installation and demos see Project Site on GitHub
1 lines • 130 kB
JSON
{"config":{"lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"Bootstrap 3 Datepicker v4 Docs Get awesome Dashboard Templates Looking for a template with the datepicker ready to go? Then get check out these templates from our partners. Creative Tim Material Dashboard Pro Gaia Bootstrap Template Pro Light Bootstrap Dashboard PRO React Flatlogic Light Blue Html5 Sing App Html5 Flatlogic One Bootstrap Template Note All functions are accessed via the data attribute e.g. $('#datetimepicker').data(\"DateTimePicker\").FUNCTION() Minimum Setup $(function () { $('#datetimepicker1').datetimepicker(); }); Code <div class=\"container\"> <div class=\"row\"> <div class='col-sm-6'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker1'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"></span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker1').datetimepicker(); }); </script> </div> </div> Using Locales $(function () { $('#datetimepicker2').datetimepicker({ locale: 'ru' }); }); Code <div class=\"container\"> <div class=\"row\"> <div class='col-sm-6'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker2'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"></span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker2').datetimepicker({ locale: 'ru' }); }); </script> </div> </div> Time Only $(function () { $('#datetimepicker3').datetimepicker({ format: 'LT' }); }); Code <div class=\"container\"> <div class=\"row\"> <div class='col-sm-6'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker3'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-time\"></span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker3').datetimepicker({ format: 'LT' }); }); </script> </div> </div> Date Only $(function () { $('#datetimepicker3').datetimepicker({ format: 'L' }); }); Code <div class=\"container\"> <div class=\"row\"> <div class='col-sm-6'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker3'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-time\"></span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker3').datetimepicker({ format: 'LT' }); }); </script> </div> </div> No Icon (input field only): $(function () { $('#datetimepicker4').datetimepicker(); }); Code <div class=\"container\"> <div class=\"row\"> <div class='col-sm-6'> <input type='text' class=\"form-control\" id='datetimepicker4' /> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker4').datetimepicker(); }); </script> </div> </div> Enabled/Disabled Dates $(function () { $('#datetimepicker5').datetimepicker({ defaultDate: \"11/1/2013\", disabledDates: [ moment(\"12/25/2013\"), new Date(2013, 11 - 1, 21), \"11/22/2013 00:53\" ] }); }); Code <div class=\"container\"> <div class=\"row\"> <div class='col-sm-6'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker5'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"></span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker5').datetimepicker({ defaultDate: \"11/1/2013\", disabledDates: [ moment(\"12/25/2013\"), new Date(2013, 11 - 1, 21), \"11/22/2013 00:53\" ] }); }); </script> </div> </div> Linked Pickers $(function () { $('#datetimepicker6').datetimepicker(); $('#datetimepicker7').datetimepicker({ useCurrent: false }); $(\"#datetimepicker6\").on(\"dp.change\", function (e) { $('#datetimepicker7').data(\"DateTimePicker\").minDate(e.date); }); $(\"#datetimepicker7\").on(\"dp.change\", function (e) { $('#datetimepicker6').data(\"DateTimePicker\").maxDate(e.date); }); }); Code <div class=\"container\"> <div class='col-md-5'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker6'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"></span> </span> </div> </div> </div> <div class='col-md-5'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker7'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"></span> </span> </div> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker6').datetimepicker(); $('#datetimepicker7').datetimepicker({ useCurrent: false //Important! See issue #1075 }); $(\"#datetimepicker6\").on(\"dp.change\", function (e) { $('#datetimepicker7').data(\"DateTimePicker\").minDate(e.date); }); $(\"#datetimepicker7\").on(\"dp.change\", function (e) { $('#datetimepicker6').data(\"DateTimePicker\").maxDate(e.date); }); }); </script> Custom Icons $(function () { $('#datetimepicker8').datetimepicker({ icons: { time: \"fa fa-clock-o\", date: \"fa fa-calendar\", up: \"fa fa-arrow-up\", down: \"fa fa-arrow-down\" } }); }); Code <div class=\"container\"> <div class=\"col-sm-6\" style=\"height:130px;\"> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker8'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"fa fa-calendar\"> </span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker8').datetimepicker({ icons: { time: \"fa fa-clock-o\", date: \"fa fa-calendar\", up: \"fa fa-arrow-up\", down: \"fa fa-arrow-down\" } }); }); </script> </div> View Mode $(function () { $('#datetimepicker9').datetimepicker({ viewMode: 'years' }); }); Code <div class=\"container\"> <div class=\"col-sm-6\" style=\"height:130px;\"> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker9'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"> </span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker9').datetimepicker({ viewMode: 'years' }); }); </script> </div> Min View Mode $(function () { $('#datetimepicker10').datetimepicker({ viewMode: 'years', format: 'MM/YYYY' }); }); Code <div class=\"container\"> <div class=\"col-sm-6\" style=\"height:130px;\"> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker10'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"> </span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker10').datetimepicker({ viewMode: 'years', format: 'MM/YYYY' }); }); </script> </div> Disabled Days of the Week $(function () { $('#datetimepicker11').datetimepicker({ daysOfWeekDisabled: [0, 6] }); }); Code <div class=\"container\"> <div class=\"col-sm-6\" style=\"height:130px;\"> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker11'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"> </span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker11').datetimepicker({ daysOfWeekDisabled: [0, 6] }); }); </script> </div> Inline $(function () { $('#datetimepicker12').datetimepicker({ inline: true, sideBySide: true }); }); Code <div style=\"overflow:hidden;\"> <div class=\"form-group\"> <div class=\"row\"> <div class=\"col-md-8\"> <div id=\"datetimepicker12\"></div> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker12').datetimepicker({ inline: true, sideBySide: true }); }); </script> </div>","title":"Usage"},{"location":"#bootstrap-3-datepicker-v4-docs","text":"","title":"Bootstrap 3 Datepicker v4 Docs"},{"location":"#minimum-setup","text":"$(function () { $('#datetimepicker1').datetimepicker(); });","title":"Minimum Setup"},{"location":"#code","text":"<div class=\"container\"> <div class=\"row\"> <div class='col-sm-6'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker1'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"></span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker1').datetimepicker(); }); </script> </div> </div>","title":"Code"},{"location":"#using-locales","text":"$(function () { $('#datetimepicker2').datetimepicker({ locale: 'ru' }); });","title":"Using Locales"},{"location":"#code_1","text":"<div class=\"container\"> <div class=\"row\"> <div class='col-sm-6'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker2'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"></span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker2').datetimepicker({ locale: 'ru' }); }); </script> </div> </div>","title":"Code"},{"location":"#time-only","text":"$(function () { $('#datetimepicker3').datetimepicker({ format: 'LT' }); });","title":"Time Only"},{"location":"#code_2","text":"<div class=\"container\"> <div class=\"row\"> <div class='col-sm-6'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker3'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-time\"></span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker3').datetimepicker({ format: 'LT' }); }); </script> </div> </div>","title":"Code"},{"location":"#date-only","text":"$(function () { $('#datetimepicker3').datetimepicker({ format: 'L' }); });","title":"Date Only"},{"location":"#code_3","text":"<div class=\"container\"> <div class=\"row\"> <div class='col-sm-6'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker3'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-time\"></span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker3').datetimepicker({ format: 'LT' }); }); </script> </div> </div>","title":"Code"},{"location":"#no-icon-input-field-only","text":"$(function () { $('#datetimepicker4').datetimepicker(); });","title":"No Icon (input field only):"},{"location":"#code_4","text":"<div class=\"container\"> <div class=\"row\"> <div class='col-sm-6'> <input type='text' class=\"form-control\" id='datetimepicker4' /> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker4').datetimepicker(); }); </script> </div> </div>","title":"Code"},{"location":"#enableddisabled-dates","text":"$(function () { $('#datetimepicker5').datetimepicker({ defaultDate: \"11/1/2013\", disabledDates: [ moment(\"12/25/2013\"), new Date(2013, 11 - 1, 21), \"11/22/2013 00:53\" ] }); });","title":"Enabled/Disabled Dates"},{"location":"#code_5","text":"<div class=\"container\"> <div class=\"row\"> <div class='col-sm-6'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker5'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"></span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker5').datetimepicker({ defaultDate: \"11/1/2013\", disabledDates: [ moment(\"12/25/2013\"), new Date(2013, 11 - 1, 21), \"11/22/2013 00:53\" ] }); }); </script> </div> </div>","title":"Code"},{"location":"#linked-pickers","text":"$(function () { $('#datetimepicker6').datetimepicker(); $('#datetimepicker7').datetimepicker({ useCurrent: false }); $(\"#datetimepicker6\").on(\"dp.change\", function (e) { $('#datetimepicker7').data(\"DateTimePicker\").minDate(e.date); }); $(\"#datetimepicker7\").on(\"dp.change\", function (e) { $('#datetimepicker6').data(\"DateTimePicker\").maxDate(e.date); }); });","title":"Linked Pickers"},{"location":"#code_6","text":"<div class=\"container\"> <div class='col-md-5'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker6'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"></span> </span> </div> </div> </div> <div class='col-md-5'> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker7'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"></span> </span> </div> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker6').datetimepicker(); $('#datetimepicker7').datetimepicker({ useCurrent: false //Important! See issue #1075 }); $(\"#datetimepicker6\").on(\"dp.change\", function (e) { $('#datetimepicker7').data(\"DateTimePicker\").minDate(e.date); }); $(\"#datetimepicker7\").on(\"dp.change\", function (e) { $('#datetimepicker6').data(\"DateTimePicker\").maxDate(e.date); }); }); </script>","title":"Code"},{"location":"#custom-icons","text":"$(function () { $('#datetimepicker8').datetimepicker({ icons: { time: \"fa fa-clock-o\", date: \"fa fa-calendar\", up: \"fa fa-arrow-up\", down: \"fa fa-arrow-down\" } }); });","title":"Custom Icons"},{"location":"#code_7","text":"<div class=\"container\"> <div class=\"col-sm-6\" style=\"height:130px;\"> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker8'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"fa fa-calendar\"> </span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker8').datetimepicker({ icons: { time: \"fa fa-clock-o\", date: \"fa fa-calendar\", up: \"fa fa-arrow-up\", down: \"fa fa-arrow-down\" } }); }); </script> </div>","title":"Code"},{"location":"#view-mode","text":"$(function () { $('#datetimepicker9').datetimepicker({ viewMode: 'years' }); });","title":"View Mode"},{"location":"#code_8","text":"<div class=\"container\"> <div class=\"col-sm-6\" style=\"height:130px;\"> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker9'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"> </span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker9').datetimepicker({ viewMode: 'years' }); }); </script> </div>","title":"Code"},{"location":"#min-view-mode","text":"$(function () { $('#datetimepicker10').datetimepicker({ viewMode: 'years', format: 'MM/YYYY' }); });","title":"Min View Mode"},{"location":"#code_9","text":"<div class=\"container\"> <div class=\"col-sm-6\" style=\"height:130px;\"> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker10'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"> </span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker10').datetimepicker({ viewMode: 'years', format: 'MM/YYYY' }); }); </script> </div>","title":"Code"},{"location":"#disabled-days-of-the-week","text":"$(function () { $('#datetimepicker11').datetimepicker({ daysOfWeekDisabled: [0, 6] }); });","title":"Disabled Days of the Week"},{"location":"#code_10","text":"<div class=\"container\"> <div class=\"col-sm-6\" style=\"height:130px;\"> <div class=\"form-group\"> <div class='input-group date' id='datetimepicker11'> <input type='text' class=\"form-control\" /> <span class=\"input-group-addon\"> <span class=\"glyphicon glyphicon-calendar\"> </span> </span> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker11').datetimepicker({ daysOfWeekDisabled: [0, 6] }); }); </script> </div>","title":"Code"},{"location":"#inline","text":"$(function () { $('#datetimepicker12').datetimepicker({ inline: true, sideBySide: true }); });","title":"Inline"},{"location":"#code_11","text":"<div style=\"overflow:hidden;\"> <div class=\"form-group\"> <div class=\"row\"> <div class=\"col-md-8\"> <div id=\"datetimepicker12\"></div> </div> </div> </div> <script type=\"text/javascript\"> $(function () { $('#datetimepicker12').datetimepicker({ inline: true, sideBySide: true }); }); </script> </div>","title":"Code"},{"location":"ChangeLog/","text":"Version 4 4.17.42 Bug Squashing fixed moment dependencies to all be the same defaulted option.timeZone to '' instead of UTC. This way it will default to the local timezone if it's not set. fixed #959 fixed #1311 internal getMoment function no longer sets startOf('d') fixed #935 Other moved some (will move the rest soon) inline docs to JSDoc now that ReSharper supports it. moved getter/setter functions to options page instead. #1313 4.17.37 New Features Momentjs TZ intergration #1242 thanks @bodrick Independent CSS file, in case you don't want bootstrap for some reason Bug Squashing Slight changes decade view Moved all tooltip text to tooltips fixed #1212 4.15.35 New Features tooltips allows custom, localized text to be included for icon tooltips Bug Squashing fixed #1066 fixed #1087 sideBySide properly supports toolbarPlacement [top, bottom] fixed #1119 fixed #1069 added input.blur() fixed #1049 fixed doc example fixed #999 picker now looks for an element with .input-group-addon 4.14.30 New Features disabledTimeIntervals #644 allowInputToggle #929 focusOnShow #884 public viewDate function #872 enabledHours and disabledHours . dp.update fires when viewDate is changed (in most cases) #937 viewMode now supports a decades view. Note : because the year picker shows 12 years at a time, I've elected to make this view show blocks of 12 years Note : when selecting a decade the viewDate will change to the center of the selected years parseInputDate #1095 Bug Squashing fixed #815 by adding .wider when using both seconds and am/pm. fixed #816 changed both min/max date to move the selected date inside. fixed #855 #881 fillDate , fillMonths , fillDow uses startOf('day') , which will hopefully fix the DST issues. fixed #885 daysOfWeekDisabled will move the date to a valid date if useCurrent is true . Today button will check if the DoW is disabled. fixed #906 fixed #912 if useCurrent:false month and year view will no longer have the current month/year selected. fixed #914 use24hours will ignore anything in side of [] in the format string. fixed #916 added titles to all icons. At some point the text should be moved to the icon's array, but this would probably be a breaking change. fixed #940 added -1 tab index to am/pm selector Other Changes changed in/decrement behavior to check if the new date is valid at that granularity (hours, minutes, seconds). will also validate as before 4.7.14 Added several in new features: `keybinds`, `inline`, `debug`, `clear()`, `showClose`, `ingoreReadOnly`, `datepickerInput` and `keepInvalid`. Bug squashing 4.0.0 Changes for using the component Defined a Public API and hidden rest of functions, variables so that all configuration options can be changed dynamically. set/getDate() is now replaced with an overloaded date() function. Use it without a parameter to get the currently set date or with a parameter to set the date. hide() , show() , toggle() , enable() , disable() and the rest of setter functions now support chaining. ie $('#id').data('DateTimePicker').format('DD-MM-YYYY').minDate(moment()).defaultDate(moment()).show() works Replaced previous - next buttons in Date subviews with configurable icons Changed language option name to locale to be inline with moment naming Implemented #402 all data-date-* variables are more readable and also match with the ones in the configuration object options.direction and options.orientation were merged into a single object options.widgetPositioning with vertical and horizontal keys that take a string value of 'auto', 'top', 'bottom' and 'auto', 'left', 'right' respectively. Note that the 'up' option was renamed to 'top' Added functionality added a second way to define options as data attributes. Instead of adding distinct data-date-* config options you can now also pass a data-date-options attribute containing an object just the same as the options object that element.datetimepicker constructor call takes also added a options() public api function to get/set that takes an option object and applies it to the component in one call Implemented #130 by introducing a boolean options.calendarWeeks and calendarWeeks() api function Implemented #328 , #426 Implemented #432 . Widget DOM element is now lazily added only when shown and removed from the document when hidden. Implemented #141 and #283 Contributors related internal code changes Refactor all UI click functions and put them as functions in the actions array private variable Refactor template building process to seperate functions according to what they do Remove some styles that where hardcoded in the javascript code Refactor all code that changes the picker.date to change it through the setValue function to allow one place for validation logic (min/max/weekdaysenabled etc) and also one place for emmiting dp.change events The v4beta branch code includes all fixes up to v.3.1.2 Added toggle() to the public API which toggles the visibility of the DateTimePicker Refactored set function to be included in the setValue function Added a testing framework using jasmine and phantom.js Version 3 3.0.0 Fix for #170, #179, #183: Changed event to dp.- . This should fix the double change event firing. Fix for #192: setDate now fires dp.change Fix for #182: Picker will not set the default date if the input field has a value Fix for #169: Seconds doesn't get reset when changing the date (Thanks to PR #174) Fix for #168 z-index fix for BS modal Fix for #155 Picker properly displays the active year and month Fix for #154 CSS update to fix the collapse jump Fix for #150 and #75 minViewMode and viewMode work properly Fix for #147 AM/PM won't toggle when selecting a value from the hours grid Fix for #44 Finally! It's here!! Thanks to @ruiwei and his code on #210 picker will adjust the positioning of the widget. Manually merged PR PR #178 When using minuteStepping the minute select grid will only show available steppings PR #195, #197 Using the data-OPTION has been changed to data-date-OPTION . These options are expected to be on the input-group if you're using the input-group or the a bare input field if you're not using the input-group PR #184 The option sideBySide change be used to display both the d and the timepicker side by side PR #143 Added option daysOfWeekDisabled: [] . For example, use daysOfWeekDisabled: [0,6] to disable Sunday and Saturday Other Changes Changed picker width to 300px if using seconds and am/pm Added option useCurrent , thanks to @ruiwei. When true, picker will set the value to the current date/time (respects picker's format) Added option showToday , thanks to @ruiwei. When true, picker will display a small arrow to indicate today's date. Changed startDate to minDate and endDate to maxDate to make it more clear what these options do. Version 2 2.1.32 (Hotfix) Fix for #151: When a bad date value or the picker is cleared, the plugin will not longer attempt to reset it back to the previous date Fix for #140: setDate can be given null to force clear the picker 2.1.30 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 2.1.20 Fix for #83: Changes to the picker should fire native change event for knockout and the like as well as change.dp which contains the old date and the new date Fix for #78: Script has been update for breaking changes in Moment 2.4.0 Fix for #73: IE8 should be working now Enhancement for #79: minuteStepping option takes a number (default is 1). Changing the minutes in the time picker will step by this number. Enhancement for #74 and #65: useMinutes and useSeconds are now options. Disabling seconds will hide the seconds spinner. Disabling minutes will display 00 and hide the arrows Enhancement for #67: Picker will now attempt to convert all data-OPTION into its appropriate option 2.1.11 Fix for #51, #60 Fix for #52: Picker has its own moment object since moment 2.4.0 has removed global reference Fix for #57: New option for useStrict . When validating dates in update and change , the picker can use a stricter formatting validation Fix for #61: Picker should now properly take formatted date. Should also have correct start of the week for locales. Fix for #62: Default format will properly validate time picker only. 2.1.5 Custom icons, such as Font Awesome, are now supported. (#49) If more then one input-group-addon is present use datepickerbutton to identify where the picker should popup from. (#48) New Event: error.dp . Fires when Moment cannot parse the date or when the timepicker cannot change because of a disabledDates setting. Returns a Moment date object. The specific error can be found be using invalidAt() . For more information see Moment's docs Fix for #42, plugin will now check for A or a in the format string to determine if the AM/PM selector should display. Fix for #45, fixed null/empty and invalid dates Fix for #46, fixed active date highlighting Fix for #47, change.dp event to also include the previous date. 2.0.1 New event error.dp fires when plugin cannot parse date or when increase/descreasing hours/minutes to a disabled date. Minor fixes 2.0.0 disabledDates is now an option to set the disabled dates. It accepts date objects like new Date(\"November 12, 2013 00:00:00\") and 12/25/2013' and moment` date objects Events are easier to use","title":"Version 4"},{"location":"ChangeLog/#version-4","text":"","title":"Version 4"},{"location":"ChangeLog/#41742","text":"","title":"4.17.42"},{"location":"ChangeLog/#bug-squashing","text":"fixed moment dependencies to all be the same defaulted option.timeZone to '' instead of UTC. This way it will default to the local timezone if it's not set. fixed #959 fixed #1311 internal getMoment function no longer sets startOf('d') fixed #935","title":"Bug Squashing"},{"location":"ChangeLog/#other","text":"moved some (will move the rest soon) inline docs to JSDoc now that ReSharper supports it. moved getter/setter functions to options page instead. #1313","title":"Other"},{"location":"ChangeLog/#41737","text":"","title":"4.17.37"},{"location":"ChangeLog/#new-features","text":"Momentjs TZ intergration #1242 thanks @bodrick Independent CSS file, in case you don't want bootstrap for some reason","title":"New Features"},{"location":"ChangeLog/#bug-squashing_1","text":"Slight changes decade view Moved all tooltip text to tooltips fixed #1212","title":"Bug Squashing"},{"location":"ChangeLog/#41535","text":"","title":"4.15.35"},{"location":"ChangeLog/#new-features_1","text":"tooltips allows custom, localized text to be included for icon tooltips","title":"New Features"},{"location":"ChangeLog/#bug-squashing_2","text":"fixed #1066 fixed #1087 sideBySide properly supports toolbarPlacement [top, bottom] fixed #1119 fixed #1069 added input.blur() fixed #1049 fixed doc example fixed #999 picker now looks for an element with .input-group-addon","title":"Bug Squashing"},{"location":"ChangeLog/#41430","text":"","title":"4.14.30"},{"location":"ChangeLog/#new-features_2","text":"disabledTimeIntervals #644 allowInputToggle #929 focusOnShow #884 public viewDate function #872 enabledHours and disabledHours . dp.update fires when viewDate is changed (in most cases) #937 viewMode now supports a decades view. Note : because the year picker shows 12 years at a time, I've elected to make this view show blocks of 12 years Note : when selecting a decade the viewDate will change to the center of the selected years parseInputDate #1095","title":"New Features"},{"location":"ChangeLog/#bug-squashing_3","text":"fixed #815 by adding .wider when using both seconds and am/pm. fixed #816 changed both min/max date to move the selected date inside. fixed #855 #881 fillDate , fillMonths , fillDow uses startOf('day') , which will hopefully fix the DST issues. fixed #885 daysOfWeekDisabled will move the date to a valid date if useCurrent is true . Today button will check if the DoW is disabled. fixed #906 fixed #912 if useCurrent:false month and year view will no longer have the current month/year selected. fixed #914 use24hours will ignore anything in side of [] in the format string. fixed #916 added titles to all icons. At some point the text should be moved to the icon's array, but this would probably be a breaking change. fixed #940 added -1 tab index to am/pm selector","title":"Bug Squashing"},{"location":"ChangeLog/#other-changes","text":"changed in/decrement behavior to check if the new date is valid at that granularity (hours, minutes, seconds). will also validate as before","title":"Other Changes"},{"location":"ChangeLog/#4714","text":"Added several in new features: `keybinds`, `inline`, `debug`, `clear()`, `showClose`, `ingoreReadOnly`, `datepickerInput` and `keepInvalid`. Bug squashing","title":"4.7.14"},{"location":"ChangeLog/#400","text":"","title":"4.0.0"},{"location":"ChangeLog/#changes-for-using-the-component","text":"Defined a Public API and hidden rest of functions, variables so that all configuration options can be changed dynamically. set/getDate() is now replaced with an overloaded date() function. Use it without a parameter to get the currently set date or with a parameter to set the date. hide() , show() , toggle() , enable() , disable() and the rest of setter functions now support chaining. ie $('#id').data('DateTimePicker').format('DD-MM-YYYY').minDate(moment()).defaultDate(moment()).show() works Replaced previous - next buttons in Date subviews with configurable icons Changed language option name to locale to be inline with moment naming Implemented #402 all data-date-* variables are more readable and also match with the ones in the configuration object options.direction and options.orientation were merged into a single object options.widgetPositioning with vertical and horizontal keys that take a string value of 'auto', 'top', 'bottom' and 'auto', 'left', 'right' respectively. Note that the 'up' option was renamed to 'top'","title":"Changes for using the component"},{"location":"ChangeLog/#added-functionality","text":"added a second way to define options as data attributes. Instead of adding distinct data-date-* config options you can now also pass a data-date-options attribute containing an object just the same as the options object that element.datetimepicker constructor call takes also added a options() public api function to get/set that takes an option object and applies it to the component in one call Implemented #130 by introducing a boolean options.calendarWeeks and calendarWeeks() api function Implemented #328 , #426 Implemented #432 . Widget DOM element is now lazily added only when shown and removed from the document when hidden. Implemented #141 and #283","title":"Added functionality"},{"location":"ChangeLog/#contributors-related-internal-code-changes","text":"Refactor all UI click functions and put them as functions in the actions array private variable Refactor template building process to seperate functions according to what they do Remove some styles that where hardcoded in the javascript code Refactor all code that changes the picker.date to change it through the setValue function to allow one place for validation logic (min/max/weekdaysenabled etc) and also one place for emmiting dp.change events The v4beta branch code includes all fixes up to v.3.1.2 Added toggle() to the public API which toggles the visibility of the DateTimePicker Refactored set function to be included in the setValue function Added a testing framework using jasmine and phantom.js","title":"Contributors related internal code changes"},{"location":"ChangeLog/#version-3","text":"","title":"Version 3"},{"location":"ChangeLog/#300","text":"Fix for #170, #179, #183: Changed event to dp.- . This should fix the double change event firing. Fix for #192: setDate now fires dp.change Fix for #182: Picker will not set the default date if the input field has a value Fix for #169: Seconds doesn't get reset when changing the date (Thanks to PR #174) Fix for #168 z-index fix for BS modal Fix for #155 Picker properly displays the active year and month Fix for #154 CSS update to fix the collapse jump Fix for #150 and #75 minViewMode and viewMode work properly Fix for #147 AM/PM won't toggle when selecting a value from the hours grid Fix for #44 Finally! It's here!! Thanks to @ruiwei and his code on #210 picker will adjust the positioning of the widget.","title":"3.0.0"},{"location":"ChangeLog/#manually-merged-pr","text":"PR #178 When using minuteStepping the minute select grid will only show available steppings PR #195, #197 Using the data-OPTION has been changed to data-date-OPTION . These options are expected to be on the input-group if you're using the input-group or the a bare input field if you're not using the input-group PR #184 The option sideBySide change be used to display both the d and the timepicker side by side PR #143 Added option daysOfWeekDisabled: [] . For example, use daysOfWeekDisabled: [0,6] to disable Sunday and Saturday","title":"Manually merged PR"},{"location":"ChangeLog/#other-changes_1","text":"Changed picker width to 300px if using seconds and am/pm Added option useCurrent , thanks to @ruiwei. When true, picker will set the value to the current date/time (respects picker's format) Added option showToday , thanks to @ruiwei. When true, picker will display a small arrow to indicate today's date. Changed startDate to minDate and endDate to maxDate to make it more clear what these options do.","title":"Other Changes"},{"location":"ChangeLog/#version-2","text":"","title":"Version 2"},{"location":"ChangeLog/#2132-hotfix","text":"Fix for #151: When a bad date value or the picker is cleared, the plugin will not longer attempt to reset it back to the previous date Fix for #140: setDate can be given null to force clear the picker","title":"2.1.32 (Hotfix)"},{"location":"ChangeLog/#2130","text":"","title":"2.1.30"},{"location":"ChangeLog/#important-buildless-file-name-has-been-been-changed-to-bootstrap-datetimepicker-buildless-to-prevent-collisions","text":"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","title":"Important! build.less file name has been been changed to bootstrap-datetimepicker-build.less to prevent collisions"},{"location":"ChangeLog/#2120","text":"Fix for #83: Changes to the picker should fire native change event for knockout and the like as well as change.dp which contains the old date and the new date Fix for #78: Script has been update for breaking changes in Moment 2.4.0 Fix for #73: IE8 should be working now Enhancement for #79: minuteStepping option takes a number (default is 1). Changing the minutes in the time picker will step by this number. Enhancement for #74 and #65: useMinutes and useSeconds are now options. Disabling seconds will hide the seconds spinner. Disabling minutes will display 00 and hide the arrows Enhancement for #67: Picker will now attempt to convert all data-OPTION into its appropriate option","title":"2.1.20"},{"location":"ChangeLog/#2111","text":"Fix for #51, #60 Fix for #52: Picker has its own moment object since moment 2.4.0 has removed global reference Fix for #57: New option for useStrict . When validating dates in update and change , the picker can use a stricter formatting validation Fix for #61: Picker should now properly take formatted date. Should also have correct start of the week for locales. Fix for #62: Default format will properly validate time picker only.","title":"2.1.11"},{"location":"ChangeLog/#215","text":"Custom icons, such as Font Awesome, are now supported. (#49) If more then one input-group-addon is present use datepickerbutton to identify where the picker should popup from. (#48) New Event: error.dp . Fires when Moment cannot parse the date or when the timepicker cannot change because of a disabledDates setting. Returns a Moment date object. The specific error can be found be using invalidAt() . For more information see Moment's docs Fix for #42, plugin will now check for A or a in the format string to determine if the AM/PM selector should display. Fix for #45, fixed null/empty and invalid dates Fix for #46, fixed active date highlighting Fix for #47, change.dp event to also include the previous date.","title":"2.1.5"},{"location":"ChangeLog/#201","text":"New event error.dp fires when plugin cannot parse date or when increase/descreasing hours/minutes to a disabled date. Minor fixes","title":"2.0.1"},{"location":"ChangeLog/#200","text":"disabledDates is now an option to set the disabled dates. It accepts date objects like new Date(\"November 12, 2013 00:00:00\") and 12/25/2013' and moment` date objects Events are easier to use","title":"2.0.0"},{"location":"ContributorsGuide/","text":"This guide is aimed to contributors wishing to understand the internals of the code in order to change/evolve the component. Note: this guide refers to version 4 which is currently in beta and will be updated as we progress Introduction This component consists actually of 2 subcomponent UI widgets one for the date and one for the time selection process. The developers can configure which of those are needed and also the granularity that the component will allow the users to select a date/time. Developers also choose the format that the selected datetime will be displayed in the input field. The component uses on jQuery , moment.js and bootstrap libraries. Code Private variables element - Holds the DOM element this instance is attached to options - Holds an object with the curently set options for the specific instance of the component. Don't directly change the properties of that object use the public API methods instead. DO NOT expose this object or its properties outside of the component. picker - Reference variable to the created instance (this) date - Holds the moment object for the model value of the component. DON'T directly change this variable unless you REALLY know what you are doing. Use setValue() function to set it. It handles all component logic for updating the model value and emitting all the appropriate events viewDate - Holds the currently selected value that the user has selected through the widget. This is not the model value this is the view value. Changing this usually requires a subsequent call to update() function unset - A boolean variable that holds wheather the components model value is set or not. Model's value starts as unset = true and if is either set by the user or programmatically through the api to a valid value then it is set to false . If subsequent events lead to an invalid value then this variable is set to true again. Setting this variable usually takes place in the setValue() function. input - Hold the DOM input element this instance is attached to component - Holds a reference to the .input-group DOM element that the widget is attached or false if it is attached directly on an input field widget - Holds a reference to the DOM element containing the widget or false if the widget is hidden use24hours - Holds whether the component uses 24 hours format or not. This is initialized on the format() function minViewModeNumber - Holds the Numeric equivelant of the options.minViewMode parameter format - Holds the current format string that is used for formating the date model value. Note this is not the same thing as the options.format as the second could be set to false in which case the first takes the locale's L or LT value currentViewMode - Hold the state of the current viewMode for the DatePicker subcomponent actions - An object containing all the functions that can be called when the users clicks on the widget datePickerModes - An array of objects with configuration parameters for the different views of the DatePicker subcomponent viewModes - An array of strings containing all the possible strings that options.viewMode can take through viewMode() public api function directionModes - An array of strings containing all the possible strings that options.direction can take through direction() public api function orientationModes - An array of strings containing all the possible strings that options.orientation can take through orientation() public api function Private functions Widget related getDatePickerTemplate() - returns a string containing the html code for the date picker subcomponent getTimePickerTemplate() - returns a string containing the html code for the time picker subcomponent getTemplate() - returns a string with containing the html code for all the DateTimePicker component place() - handles the placement of the widget's dropdown updateMonths() - updates the html subpage related to the months for Date picker view updateYears() - updates the html subpage related to the years for Date picker view fillDate() - updates the html subpage related to the days for Date picker view fillHours() - Creates the hours spans for the hours subview of the Time subcomponent fillMinutes() - Creates the minutes spans for the hours subview of the Time subcomponent fillSeconds() - Creates the seconds spans for the hours subview of the Time subcomponent fillTime() - Creates the main subview of the Time subcomponent update() - updates the UI of part of the widget fillDow() - Creates the day names in the days subview on the Date subcomponent fillMonths() - Creates the month spans for the months subview of the Date subcomponent createWidget() - creates the UI widget end attaches widget event listeners destroyWidget() - destroys the UI widget DOM element and detaches widget event listeners showMode(dir) - toggles between the various subpage related views of the DateTimePicker Events related notifyEvent(e) - Use this function when you want to send en event to listener this could be used as a filter later stopEvent(e) - Shortcut for stopping propagation of events doAction(e) - Proxy function to call all the UI related click events keydown(e) - Function to trap change(e) - Listener function to track change events occuring on the input dom element the component is attached to attachDatePickerElementEvents() - Attaches listeners to the existing DOM elements the component is attached to. Called upon construction of each datetimepicker instance detachDatePickerElementEvents() - Detaches listeners from the DOM element the component is attached to. Called on destroy() attachDatePickerWidgetEvents() - Attaches listeners on the components widget. Called on show() detachDatePickerWidgetEvents() - Detaches listeners on the components widget. Called on hide() Model related setValue(targetMoment) - Sets the model value of the component takes a moment object. An error event will be emmited if the targetMoment does not pass the configured validations. Otherwise the date variable will be set and the relevant events will be fired. isValid(targetMoment, granularity) - returns true if the targetMoment moment object is valid according to the components set validation rules ( min/maxDates , disabled/enabledDates and daysOfWeekDisabled ). You may pass a second variable to check only up the the specific granularity year, month, day, hour, minute, second Utilities indexGivenDates (givenDatesArray) - Function that takes the array from enabledDates() and disabledDates() public functions and stores them as object keys to enable quick lookup isInEnableDates(date) - Checks whether if the given moment object exists in the options.enabledDates object isInDisableDates(date) - Checks whether if the given moment object exists in the options.disabledDates array dataToOptions() - Parses data-date-* options set on the input dom element the component is attached to and returns an object with them isInFixed() - Checks if the dom element or its parents has a fixed position css rule. parseInputDate(date) - Parses a date parameter with moment using the component's options.format and options.useStrict . It returns a moment object or false if parsedMoment#isValid() returns false . Use this to parse date inputs from outside the component (public API calls). init() - Initializes the component. Called when the component instance is created","title":"Dev Guide"},{"location":"ContributorsGuide/#introduction","text":"This component consists actually of 2 subcomponent UI widgets one for the date and one for the time selection process. The developers can configure which of those are needed and also the granularity that the component will allow the users to select a date/time. Developers also choose the format that the selected datetime will be displayed in the input field. The component uses on jQuery , moment.js and bootstrap libraries.","title":"Introduction"},{"location":"ContributorsGuide/#code","text":"","title":"Code"},{"location":"ContributorsGuide/#private-variables","text":"element - Holds the DOM element this instance is attached to options - Holds an object with the curently set options for the specific instance of the component. Don't directly change the properties of that object use the public API methods instead. DO NOT expose this object or its properties outside of the component. picker - Reference variable to the created instance (this) date - Holds the moment object for the model value of the component. DON'T directly change this variable unless you REALLY know what you are doing. Use setValue() function to set it. It handles all component logic for updating the model value and emitting all the appropriate events viewDate - Holds the currently selected value that the user has selected through the widget. This is not the model value this is the view value. Changing this usually requires a subsequent call to update() function unset - A boolean variable that holds wheather the components model value is set or not. Model's value starts as unset = true and if is either set by the user or programmatically through the api to a valid value then it is set to false . If subsequent events lead to an invalid value then this variable is set to true again. Setting this variable usually takes place in the setValue() function. input - Hold the DOM input element this instance is attached to component - Holds a reference to the .input-group DOM element that the widget is attached or false if it is attached directly on an input field widget - Holds a reference to the DOM element containing the widget or false if the widget is hidden use24hours - Holds whether the component uses 24 hours format or not. This is initialized on the format() function minViewModeNumber - Holds the Numeric equivelant of the options.minViewMode parameter format - Holds the current format string that is used for formating the date model value. Note this is not the same thing as the options.format as the second could be set to false in which case the first takes the locale's L or LT value currentViewMode - Hold the state of the current viewMode for the DatePicker subcomponent actions - An object containing all the functions that can be called when the users clicks on the widget datePickerModes - An array of objects with configuration parameters for the different views of the DatePicker subcomponent viewModes - An array of strings containing all the possible strings that options.viewMode can take through viewMode() public api function directionModes - An array of strings containing all the possible strings that options.direction can take through direction() public api function orientationModes - An array of strings containing all the possible strings that options.orientation can take through orientation() public api function","title":"Private variables"},{"location":"ContributorsGuide/#private-functions","text":"","title":"Private functions"},{"location":"ContributorsGuide/#widget-related","text":"getDatePickerTemplate() - returns a string containing the html code for the date picker subcomponent getTimePickerTemplate() - returns a string containing the html code for the time picker subcomponent getTemplate() - returns a string with containing the html code for all the DateTimePicker component place() - handles the placement of the widget's dropdown updateMonths() - updates the html subpage related to the months for Date picker view updateYears() - updates the html subpage related to the years for Date picker view fillDate() - updates the html subpage related to the days for Date picker view fillHours() - Creates the hours spans for the hours subview of the Time subcomponent fillMinutes() - Creates the minutes spans for the hours subview of the Time subcomponent fillSeconds() - Creates the