Demo: http://plnkr.co/edit/HyGjgy?p=preview
The control is based on AngularUI Datepicker and Timepicker.
Date is formatted using the date filter and is localized.
##Install
###Bower
Run bower install angular-ui-bootstrap-datetimepicker --save
to persist it to bower.json
Include the ui.bootstrap.datetimepicker
module in your app.js
file. You must be using the ui.bootstrap
module as well.
###NuGet
See https://www.nuget.org/packages/Angular-js-bootstrap-datetimepicker/
##Usage Sample
// Disable weekend selection
$scope.isDisabledDate = function(currentDate, mode) {
return mode === 'day' && (currentDate.getDay() === 0 || currentDate.getDay() === 6);
};
<datetimepicker ng-model="date"
date-format="dd-MMM-yyyy"
date-options="dateOptions"
date-disabled="isDisabledDate(date, mode)">
</datetimepicker>
-
ng-model
: The date and time object. -
date-disabled (date, mode)
(Default: null) : An optional expression to disable visible options based on passing date and current mode (day|month|year). -
day-format
(Default: 'dd') : Format of day in month. -
month-format
(Default: 'MMMM') : Format of month in year. -
year-format
(Default: 'yyyy') : Format of year in year range. -
year-range
(Default: 20) : Number of years displayed in year selection. -
day-header-format
(Default: 'EEE') : Format of day in week header. -
day-title-format
(Default: 'MMMM yyyy') : Format of title when selecting day. -
month-title-format
(Default: 'yyyy') : Format of title when selecting month. -
date-format
(Default: 'yyyy-MM-dd') : The format for displayed dates. -
date-options
attribute. (Default: {}) : Options for datepicker in JSON format. E.g. minDate and maxDate, which define the minimum and maximum available date and time. -
hour-step
(Defaults: 1) : Number of hours to increase or decrease when using a button. -
minute-step
(Defaults: 1) : Number of minutes to increase or decrease when using a button. -
show-meridian
(Defaults: true) : Whether to display 12H or 24H mode. -
meridians
(Defaults: ['AM', 'PM']) : Meridian labels -
readonly-time
(Defaults: false) : Whether a user can type inside the hours & minutes input. -
disabled-date
(Defaults: false) : Whether the date input is disabled. -
readonly-date
(Defaults: false) : Whether a user can type inside the date input. -
hidden-time
(Defaults: false) : Whether a user can see the hours & minutes input. -
hidden-date
(Defaults: false) : Whether a user can see the date input. -
mousewheel
(Defaults: true) : Whether user can scroll inside the hours & minutes input to increase or decrease it's values. -
show-spinners
(Defaults: true) : Shows spinner arrows above and below the inputs. -
show-button-bar
(Defaults: true) : Whether or not to display a button bar underneath the uib-datepicker.. -
current-text
(Default: 'Today') : The text to display for the current day button. -
clear-text
(Default: 'Clear') : The text to display for the clear button. -
close-text
(Default: 'Done') : The text to display for the close popup button.